<template>
  <!--<el-button @click="testclk">测试</el-button>
      <vxe-grid :columns="tableColumn" :loading="loading" :pager-config="tablePagepx" sortable :proxy-config="tableProxy" border height="486px" highlight-current-row highlight-hover-row ref="ddlCommonTable" resizable size="mini" stripe :select-config="selectConfig"></vxe-grid>-->
  <div v-loading="pageinitloading" element-loading-spinner="el-icon-loading"
    element-loading-background="rgba(0, 0, 0, 0.8)" style="height: 100%; width: 100%; position: relative"
    @click="RefreshLock" @keypress="RefreshLock">
    <el-image :src="imgUrl" style="position: absolute; top: 200px; left: 80px" v-show="imgUrl"> </el-image>
    <div v-if="specialtypena" class="special-pat-mark">
      <span class="sample-showmark  sample-contamination">{{ specialtypena }}</span>
    </div>
    <!--<el-image :src="imgQUrl" style="position:absolute; top:200px;left:80px" v-else-if="Options.onlymodifymyreport == '1' && $tool.getSession(this.$tool.loginuserno) !=PatientInfo['report_user'] "></el-image>-->
    <rm-layout-right splitcolor="#ffffff" :splitwidth="3" :fixsize="fixright" :minfixsize="200" ref="layoutright">
      <rm-layout-top :canDrag="false" :fixsize="30" :splitwidth="3">
        <template v-slot:fix>
          <div :style="{ borderBottom: 'solid 1px #e6e6e6', overflow: 'hidden', '--basecolor': basecolor }"
            :class="DateBackGround()">
            <table style="min-width: 600px">
              <tr>
                <td style="color: #0095d9; width: 50px">标本编号</td>
                <td>
                  <el-input v-model="specno" @change="SpecNoChange()" @keyup.native="btKeyUp"
                    @keyup.enter.native="SpecNoChange()" @focus="InputFocus('specno')" class="specclass"
                    style="width: 180px" ref="specno"></el-input>
                </td>
                <td style="color: #0095d9">
                  <div style="margin-left: 5px">日期</div>
                </td>
                <td>
                  <el-checkbox v-model="lockselectdate" style="margin-left: 5px"> 锁定</el-checkbox>
                </td>
                <td>
                  <el-date-picker class="sampledateclass" v-model="selectdate" value-format="yyyy-MM-dd HH:mm:ss"
                    :picker-options="pickerOptions" :clearable="false" style="width: 130px" @change="selectdateChange"
                    ref="specdate"></el-date-picker>
                </td>
                <td style="color: #0095d9">
                  <div style="margin-left: 5px">单元</div>
                </td>
                <td>
                  <rm-ddl-rptunit class="rptunitdllclass" :prgno="PRGNO" v-model="rptunitid" width="240px"
                    :clearable="false" ref="rptunit" :disabled="myreport || mygreport || !!rptunitgroup"
                    :beforeChange="beforeChange"></rm-ddl-rptunit>
                </td>
              </tr>
            </table>
          </div>
        </template>
        <rm-layout-left :canDrag="false" :fixsize="Begincheckmode ? 0 : fixleft" :minfixsize="Begincheckmode ? 0 : 230"
          :splitwidth="0" ref="leftdrag">
          <template v-slot:fix>
            <div id="leftMainDiv"
              v-bind:style="{ zoom: leftZoom, overflow: 'hidden', width: '230px', height: '100%', positon: 'absolute' }"
              v-show="!Begincheckmode">
              <el-form ref="masterListForm" :model="PatientInfo" size="mini">
                <table style="margin-right: 0px; width: 100%; border-spacing: 3px" class="tableleft">
                  <tr v-for="item in ColData" :key="item.col_code" v-show="item.visibled">
                    <td style="width: 50px">
                      <div style="width: 50px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap">
                        <span v-if="item.bold" style="font-weight: bold; font-size:14px;">{{ item.col_label }}</span>
                        <span v-else>{{ item.col_label }}</span>
                      </div>
                    </td>
                    <td
                      v-if="PatientInfo['rechkflag'] == '9' || (PatientInfo['rechkflag'] == '1' && Options.canupdateaftersign != '1') || (Options.onlymodifymyreport == '1' && $tool.getSession(this.$tool.loginuserno) != PatientInfo['report_user']) || (PatientInfo.barcode && PatientInfo.barcode.indexOf('-退') > -1)">
                      <el-tooltip class="item" effect="light" placement="top-start" :disabled="tooltipsdiable">
                        <div slot="content" style="width: 160px">{{ tooltipcontent }}</div>
                        <div style="width: 160px" v-if="item.col_code === 'pat_sex'" v-show="item.visibled">
                          <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                            v-model="PatientInfo[item.col_code + 'name']" style="width: 60%"
                            @keyup.enter.native="EnterEvent(item.col_code)" :ref="item.col_code"
                            @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" readonly
                            size="mini"></el-input>
                          <el-checkbox v-model="PatientInfo['emer_flag']" true-label="1" false-label="0"
                            style="padding-left: 5px" ref="emer_flag" disabled class="emerflagredcolor">加急</el-checkbox>
                        </div>
                        <div style="width: 160px" v-else-if="item.col_code === 'markreason'" v-show="item.visibled">
                          <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                            v-model="PatientInfo[item.col_code]"
                            :style="{ width: Options.checkmustpassmarkreason == '1' ? '80%' : '100%' }"
                            @keyup.enter.native="EnterEvent(item.col_code)" :ref="item.col_code"
                            @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" readonly
                            size="mini"></el-input>
                          <el-checkbox v-if="Options.checkmustpassmarkreason == '1'"
                            v-model="PatientInfo['markreasonpass']" true-label="2" false-label="1"
                            style="padding-left: 5px" ref="markreasonpass"
                            :disabled="markreasonpasseditflag"></el-checkbox>
                        </div>
                        <div style="width: 100%" v-else-if="item.col_code === 'pat_no'" v-show="item.visibled">
                          <table style="border-spacing: 0px">
                            <tr>
                              <td style="text-align: left; width: 160px">
                                <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight"
                                  resize="none" v-model="PatientInfo[item.col_code]" style="width: 100%"
                                  @keyup.enter.native="EnterEvent(item.col_code)" :ref="item.col_code"
                                  @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" readonly
                                  size="mini"></el-input>
                              </td>
                              <td>
                                <div class="el-button el-button--mini"
                                  style="height: 20px; margin-left: 2px; font-size: 10px; padding: 5px 14px">读卡</div>
                              </td>
                            </tr>
                          </table>
                        </div>
                        <div style="width: 100%"
                          v-else-if="item.col_code === 'req_wardno' || item.col_code === 'req_deptno' || item.col_code === 'req_docno'"
                          v-show="item.visibled">
                          <table style="border-spacing: 0px">
                            <tr>
                              <td style="text-align: left; width: 170px">
                                <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight"
                                  resize="none" v-model="PatientInfo[item.col_code + 'name']"
                                  @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled" readonly
                                  :ref="item.col_code" size="mini"
                                  @dblclick.native="ShowDialogMsg(PatientInfo[item.col_code + 'name'], item.col_label)"
                                  @mouseover.native="tooltipmousover(item.col_code, item.valuetype)"></el-input>
                              </td>
                              <td>
                                <el-popover placement="right" trigger="click" :content="deptwardtelnum"
                                  @show="GetTelNum(item.col_code)">
                                  <div class="el-button" slot="reference"
                                    style="height: 20px; margin-left: 2px; font-size: 10px; padding: 4px 4px"
                                    @mouseover="tooltipmousover(item.col_code, item.valuetype)"><i
                                      class="el-icon-phone"></i></div>
                                </el-popover>
                              </td>
                            </tr>
                          </table>
                        </div>
                        <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                          v-model="PatientInfo[item.col_code]" v-else-if="item.col_code === 'lab_advice'"
                          @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled" size="mini"
                          :ref="item.col_code"
                          @dblclick.native="ShowDialogMsg(PatientInfo[item.col_code], item.col_label)"
                          @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" readonly></el-input>
                        <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                          v-model="PatientInfo[item.col_code + 'name']"
                          v-else-if="item.valuetype == '5' && item.col_code != 'pat_agestr'"
                          @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled" readonly
                          :ref="item.col_code" size="mini"
                          @dblclick.native="ShowDialogMsg(PatientInfo[item.col_code + 'name'], item.col_label)"
                          @mouseover.native="tooltipmousover(item.col_code, item.valuetype)"></el-input>
                        <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                          v-else v-model="PatientInfo[item.col_code]" v-show="item.visibled" readonly size="mini"
                          @dblclick.native="ShowDialogMsg(PatientInfo[item.col_code], item.col_label)"
                          @mouseover.native="tooltipmousover(item.col_code, item.valuetype)"></el-input>
                      </el-tooltip>
                    </td>
                    <td v-else>
                      <div>
                        <el-tooltip class="item" effect="light" placement="top-start" :disabled="tooltipsdiable">
                          <div slot="content" style="width: 160px">{{ tooltipcontent }}</div>
                          <div style="width: 100%" v-if="item.col_code === 'pat_sex'" v-show="item.visibled">
                            <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                              v-model="PatientInfo[item.col_code + 'name']" style="width: 60%"
                              :disabled="ItemEnable(item)" @keyup.enter.native="EnterEvent(item.col_code)"
                              @dblclick.native="inputdblEvent(item.col_code)"
                              @keyup.up.native="InputMove(0, item.col_code)"
                              @keyup.down.native="InputMove(1, item.col_code)" @change="popinputchange($event, item)"
                              :readonly="item.noedit" @focus="InputFocus(item.col_code)"
                              @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" :ref="item.col_code"
                              size="mini"></el-input>
                            <el-checkbox v-model="PatientInfo['emer_flag']" true-label="1" false-label="0"
                              style="padding-left: 5px" ref="emer_flag" class="emerflagredcolor">加急</el-checkbox>
                          </div>
                          <div style="width: 100%" v-else-if="item.col_code === 'markreason'" v-show="item.visibled">
                            <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                              v-model="PatientInfo[item.col_code]"
                              :style="{ width: Options.checkmustpassmarkreason == '1' ? '80%' : '100%' }"
                              :disabled="ItemEnable(item)" @keyup.enter.native="EnterEvent(item.col_code)"
                              @dblclick.native="inputdblEvent(item.col_code)"
                              @keyup.up.native="InputMove(0, item.col_code)"
                              @keyup.down.native="InputMove(1, item.col_code)" @change="popinputchange($event, item)"
                              :readonly="item.noedit" @focus="InputFocus(item.col_code)"
                              @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" :ref="item.col_code"
                              size="mini"></el-input>
                            <el-checkbox v-if="Options.checkmustpassmarkreason == '1'"
                              v-model="PatientInfo['markreasonpass']" true-label="2" false-label="1"
                              style="padding-left: 5px" ref="markreasonpass"
                              :disabled="markreasonpasseditflag"></el-checkbox>
                          </div>
                          <div style="width: 100%" v-else-if="item.col_code === 'pat_no'" v-show="item.visibled">
                            <table style="border-spacing: 0px">
                              <tr>
                                <td style="text-align: left; width: 160px">
                                  <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight"
                                    resize="none" v-model="PatientInfo[item.col_code]"
                                    @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled"
                                    :disabled="ItemEnable(item)" @change="inputChangeEvent($event, item.col_code)"
                                    @keyup.up.native="InputMove(0, item.col_code)"
                                    @keyup.down.native="InputMove(1, item.col_code)" @focus="InputFocus(item.col_code)"
                                    @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" size="mini"
                                    :ref="item.col_code"></el-input>
                                </td>
                                <td>
                                  <div @click="ReadCard()" class="el-button el-button--mini"
                                    style="height: 20px; margin-left: 2px; font-size: 10px; padding: 5px 14px">读卡</div>
                                </td>
                              </tr>
                            </table>
                          </div>
                          <div style="width: 100%"
                            v-else-if="item.col_code === 'req_wardno' || item.col_code === 'req_deptno' || item.col_code === 'req_docno'"
                            v-show="item.visibled">
                            <table style="border-spacing: 0px">
                              <tr>
                                <td style="text-align: left; width: 170px">
                                  <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight"
                                    resize="none" v-model="PatientInfo[item.col_code + 'name']"
                                    @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled"
                                    :disabled="ItemEnable(item)" @keyup.space.native="SpaceEvent(item.col_code)"
                                    @keyup.up.native="InputMove(0, item.col_code)"
                                    @keyup.down.native="InputMove(1, item.col_code)"
                                    @dblclick.native="inputdblEvent(item.col_code)" @change="popinputchange($event, item)"
                                    :readonly="item.noedit" @focus="InputFocus(item.col_code)"
                                    @mouseover.native="tooltipmousover(item.col_code, item.valuetype)"
                                    :ref="item.col_code" size="mini"></el-input>
                                </td>
                                <td>
                                  <el-popover placement="right" trigger="click" :content="deptwardtelnum"
                                    @show="GetTelNum(item.col_code)">
                                    <div class="el-button" slot="reference"
                                      style="height: 20px; margin-left: 2px; font-size: 10px; padding: 4px 4px"
                                      @mouseover="tooltipmousover(item.col_code, item.valuetype)"><i
                                        class="el-icon-phone"></i></div>
                                  </el-popover>
                                </td>
                              </tr>
                            </table>
                          </div>
                          <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                            v-model="PatientInfo[item.col_code]"
                            v-else-if="item.col_code === 'lab_advice' || item.valuetype == '6' || item.col_code.indexOf('reserve') > -1 || item.col_code.indexOf('txtinfo') > -1"
                            @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled"
                            @keyup.space.native="SpaceEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)"
                            @keyup.down.native="InputMove(1, item.col_code)"
                            @dblclick.native="inputdblEvent(item.col_code)" @change="popinputchange($event, item)"
                            :readonly="item.noedit" @focus="InputFocus(item.col_code)"
                            @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" size="mini"
                            :ref="item.col_code"></el-input>
                          <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                            v-model="PatientInfo[item.col_code]" v-else-if="item.col_code === 'pat_agestr'"
                            @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled"
                            :disabled="ItemEnable(item)" @keyup.space.native="SpaceEvent(item.col_code)"
                            @keyup.up.native="InputMove(0, item.col_code)"
                            @keyup.down.native="InputMove(1, item.col_code)"
                            @dblclick.native="inputdblEvent(item.col_code)" @change="popinputchange($event, item)"
                            @focus="InputFocus(item.col_code)" :readonly="item.noedit"
                            @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" size="mini"
                            :ref="item.col_code"></el-input>
                          <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                            v-model="PatientInfo[item.col_code]" v-else-if="item.col_code === 'req_reason'"
                            @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled"
                            :disabled="!item.enabled" @keyup.space.native="SpaceEvent(item.col_code)"
                            @keyup.up.native="InputMove(0, item.col_code)"
                            @keyup.down.native="InputMove(1, item.col_code)" @dblclick.native="reqdbleclick('1')"
                            @focus="InputFocus(item.col_code)"
                            @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" size="mini"
                            :ref="item.col_code"></el-input>
                          <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                            v-model="PatientInfo[item.col_code + 'name']" v-else-if="item.valuetype == '5'"
                            @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled"
                            :disabled="ItemEnable(item)" @keyup.space.native="SpaceEvent(item.col_code)"
                            @keyup.up.native="InputMove(0, item.col_code)"
                            @keyup.down.native="InputMove(1, item.col_code)"
                            @dblclick.native="inputdblEvent(item.col_code)" @change="popinputchange($event, item)"
                            :readonly="item.noedit" @focus="InputFocus(item.col_code)"
                            @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" :ref="item.col_code"
                            size="mini"></el-input>
                          <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                            v-model="PatientInfo[item.col_code]" v-else-if="item.valuetype == '2'"
                            @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled"
                            :disabled="ItemEnable(item)" @change="inputChangeEvent($event, item.col_code)"
                            @keyup.up.native="InputMove(0, item.col_code)"
                            @keyup.down.native="InputMove(1, item.col_code)" @focus="InputFocus(item.col_code)"
                            @dblclick.native="ShowDialogMsg(PatientInfo[item.col_code], item.col_label)"
                            @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" size="mini"
                            :ref="item.col_code"
                            :class="item.col_code == 'pat_diag' && specialdiagflag == '1' ? 'inputred' : ''"></el-input>
                          <el-date-picker v-model="PatientInfo[item.col_code]" v-else-if="item.valuetype === '7'"
                            :inputable="true" v-show="item.visibled" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                            @keyup.enter.native="EnterEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)"
                            @keyup.down.native="InputMove(1, item.col_code)"
                            @mouseover.native="tooltipmousover(item.col_code, item.valuetype)" :disabled="!item.enabled"
                            @focus="InputFocus(item.col_code)" @change="datechangelist($event, item.col_code)" size="mini"
                            style="width: 100%" :ref="item.col_code"></el-date-picker>
                        </el-tooltip>
                      </div>
                    </td>
                  </tr>
                </table>
              </el-form>
            </div>
          </template>
          <div id="centerMainDiv" @contextmenu.prevent="RightClick" @dblclick="CenterDblClick"
            v-bind:style="{ zoom: centerZoom, height: '100%' }">
            <rm_Lab_Result h="100%" :w="resultw" :pOptions="Options" :PatientInfo="PatientInfo" :rptunitid="rptunitid"
              @change="ResultChange" @PatChange="ResultPatChange" @ShowReportPDF="ShowReportPdf" ref="rmlabresult"
              v-if="PRGNO == 'LIS310'"></rm_Lab_Result>
            <rm_Lab_ResultGerm h="100%" :w="resultw" :pOptions="Options" :PatientInfo="PatientInfo" :rptunitid="rptunitid"
              @change="ResultChange" @PatChange="ResultPatChange" @AfterPrint="AfterPrintGermSheet" ref="rmlabresult"
              v-else-if="PRGNO == 'LIS311'"></rm_Lab_ResultGerm>
            <!-- 骨髓报告-->
            <rm_Lab_ResultMarrow h="100%" :w="resultw" :pOptions="Options" :PatientInfo="PatientInfo"
              :rptunitid="rptunitid" ref="rmlabresult" v-else-if="PRGNO == 'LIS313'"></rm_Lab_ResultMarrow>
            <!--end-->
            <!-- 报告导出-->
            <rm_Lab_ResultUpload h="100%" :w="resultw" :pOptions="Options" :PatientInfo="PatientInfo"
              :rptunitid="rptunitid" @uploadFile="UploadPDF" ref="rmlabresult" v-else-if="PRGNO == 'LIS312'"
              @ShowReportPDF="ShowReportPdf"></rm_Lab_ResultUpload>
            <!--end-->
            <rm_Lab_ResultGene h="100%" :w="resultw" :pOptions="Options" :PatientInfo="PatientInfo" :rptunitid="rptunitid"
              @change="ResultChange" @PatChange="ResultPatChange" ref="rmlabresult" v-if="PRGNO == 'LIS314'">
            </rm_Lab_ResultGene>
          </div>
        </rm-layout-left>
      </rm-layout-top>
      <template v-slot:fix>
        <div ref="xTableDiv" id="rightMainDiv" v-bind:style="{ zoom: rightZoom, height: '100%' }">
          <el-tabs @tab-click="handleTabClick" v-model="tabvalue" style="height: 100%" type="border-card" ref="tabs"
            class="Tabundefined RMTab">
            <el-tab-pane v-if="Tablist.split(',').indexOf('1') > -1" label="列表" name="1" key="1" class="Listclass">
              <rm-layout-top :canDrag="false" :fixsize="36" :splitwidth="0" addfixstyle="overflow:hidden;"
                addautopartstyle="overflow:hidden;">
                <template v-slot:fix>
                  <div>
                    <table>
                      <tr>
                        <td style="width: 40px; text-align: left">
                          <el-button @click="RefreshList()">&nbsp;刷&nbsp;新&nbsp;(R)</el-button>
                        </td>
                        <td>
                          <el-button @click="dialogDelVisible = true">&nbsp;删&nbsp;除(D)</el-button>
                        </td>
                        <td>
                          <el-popover placement="bottom" width="580" trigger="click" v-model="filtervisible">
                            <div>
                              <div style="padding-top: 5px; padding-left: 17px">
                                <el-checkbox v-model="myreport">我的报告(所有)</el-checkbox>
                                <el-checkbox v-model="mygreport" style="margin-left: 6px">本组报告</el-checkbox>
                                <el-checkbox v-model="myunitreport" style="margin-left: 6px">我的报告(当前单元)</el-checkbox>
                                <el-checkbox v-model="pagebylist" style="margin-left: 6px">根据列表翻页</el-checkbox>
                              </div>
                              <el-divider></el-divider>
                              <table style="padding-left: 15px; width: 100%">
                                <tr v-show="rptunitgroupfilter.length > 0">
                                  <td style="font-size: 12px; text-align: left; width: 60px">单元组合</td>
                                  <td>
                                    <el-select v-model="rptunitgroup" clearable filterable>
                                      <el-option v-for="(item, index) in rptunitgroupfilter" :key="index"
                                        :value="item.rptunitgroupid" :label="item.rptunitgroupname">
                                      </el-option>
                                    </el-select>
                                  </td>
                                </tr>
                                <tr v-show="Customfilter.length > 0">
                                  <td style="font-size: 12px; text-align: left; width: 60px">自定义</td>
                                  <td>
                                    <el-radio-group v-model="ListSearchFilter.Custom" size="mini">
                                      <table>
                                        <tr>
                                          <td v-for="(item, index) in Customfilter" :key="index" style="text-align: left">
                                            <el-radio :label="item" size="mini"></el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr v-show="Options.showmultiitemrule == '1'">
                                  <td style="font-size: 12px; text-align: left; width: 60px">异常状态</td>
                                  <td>
                                    <el-radio-group v-model="ListSearchFilter.Exceptionflag" size="mini">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部" size="mini"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="有异常项目结果" size="mini"></el-radio>
                                          </td>
                                          <td style="text-align: left">
                                            <el-radio label="无异常项目结果" size="mini"></el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr v-show="Options.checkmustsignname == '1'">
                                  <td style="font-size: 12px; text-align: left; width: 60px">签名状态</td>
                                  <td>
                                    <el-radio-group v-model="ListSearchFilter.Signflag" size="mini">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部" size="mini"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="未签名" size="mini"></el-radio>
                                          </td>
                                          <td style="text-align: left">
                                            <el-radio label="已签名" size="mini"></el-radio>
                                          </td>
                                          <td style="text-align: left">
                                            <el-radio label="待签名" size="mini"></el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr>
                                  <td style="font-size: 12px; text-align: left; width: 60px">审核状态</td>
                                  <td>
                                    <el-radio-group v-model="ListSearchFilter.Checkflag" size="mini">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部" size="mini"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="未审核" size="mini"></el-radio>
                                          </td>
                                          <td style="text-align: left">
                                            <el-radio label="已审核" size="mini"></el-radio>
                                          </td>
                                          <td style="text-align: left">
                                            <el-radio label="待审核" size="mini"></el-radio>
                                          </td>

                                          <td style="text-align: left" v-if="Options.autochkbyservice == '1'">
                                            <el-radio label="自动审核" size="mini"></el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr>
                                  <td style="font-size: 12px; text-align: left; width: 60px">打印状态</td>
                                  <td>
                                    <el-radio-group v-model="ListSearchFilter.Printflag" size="mini">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部" size="mini"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="未打印" size="mini"></el-radio>
                                          </td>
                                          <td style="text-align: left">
                                            <el-radio label="已打印" size="mini"></el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr>
                                  <td style="font-size: 12px; text-align: left; width: 60px">加急状态</td>
                                  <td style="text-align: left">
                                    <el-radio-group v-model="ListSearchFilter.Emerflag" size="mini">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部" size="mini"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="加急标本" size="mini"></el-radio>
                                          </td>
                                          <td style="text-align: left">
                                            <el-radio label="常规标本" size="mini"></el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr>
                                  <td style="font-size: 12px; text-align: left; width: 60px">复查状态</td>
                                  <td style="text-align: left">
                                    <el-radio-group v-model="ListSearchFilter.Rechkflag" size="mini">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="待复查"></el-radio>
                                          </td>
                                          <td style="text-align: left">
                                            <el-radio label="已复查"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="无需复查"></el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr>
                                  <td style="font-size: 12px; text-align: left; width: 60px">完成状态</td>
                                  <td style="text-align: left">
                                    <el-radio-group v-model="ListSearchFilter.Completeflag" size="mini">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="未完成"></el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr>
                                  <td style="font-size: 12px; text-align: left; width: 60px">收费状态</td>
                                  <td>
                                    <el-radio-group v-model="ListSearchFilter.Chargeflag" size="mini">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="未收费"></el-radio>
                                          </td>
                                          <td style="text-align: left">
                                            <el-radio label="已收费"></el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr>
                                  <td style="font-size: 12px; text-align: left; width: 60px">病人类型</td>
                                  <td style="text-align: left">
                                    <el-radio-group v-model="ListSearchpattype">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部" key="全部">全部</el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="门诊" key="门诊">门诊</el-radio>
                                          </td>
                                          <td style="text-align: left">
                                            <el-radio label="住院" key="住院">住院</el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="体检" key="体检">体检</el-radio>
                                          </td>
                                          <td style="text-align: left">
                                            <el-radio label="急诊" key="急诊">急诊</el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="其他" key="其他">其他</el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr>
                                  <td style="font-size: 12px; text-align: left; width: 60px">其他分类</td>
                                  <td colspan="2" style="text-align: left">
                                    <el-radio-group v-model="ListSearchOtherflag">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部">全部</el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="阳性报告">阳性报告</el-radio>
                                          </td>
                                          <td style="text-align: left">
                                            <el-radio label="危急值报告">危急值报告</el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="剔回标本的报告">剔回标本的报告</el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr>
                                  <td style="font-size: 12px; text-align: left; width: 60px">标记状态</td>
                                  <td>
                                    <el-radio-group v-model="ListSearchFilter.Markflag" size="mini">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="已标记"></el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr>
                                  <td style="font-size: 12px; text-align: left; width: 60px">超时状态</td>
                                  <td>
                                    <el-radio-group v-model="ListSearchFilter.OverTimeflag" size="mini">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="已超时"></el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <!--临时加的，后面不用了删掉-->
                                <tr>
                                  <td style="font-size: 12px; text-align: left; width: 60px">核酸分类</td>
                                  <td>
                                    <el-radio-group v-model="ListSearchFilter.Nucleinflag" size="mini">
                                      <table>
                                        <tr>
                                          <td style="text-align: left">
                                            <el-radio label="全部"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="核酸混采"></el-radio>
                                          </td>
                                          <td>
                                            <el-radio label="核酸单采"></el-radio>
                                          </td>
                                        </tr>
                                      </table>
                                    </el-radio-group>
                                  </td>
                                </tr>
                                <tr>
                                  <td colspan="3">
                                    <div style="padding-bottom: 5px; padding-right: 5px">
                                      <el-button @click.native="StatuChange(1)">确 定</el-button>
                                      <el-button
                                        @click.native="(ListSearchFilter = { Checkflag: '全部', Printflag: '全部', Emerflag: '全部', Rechkflag: '全部', Completeflag: '全部', Chargeflag: '全部', Markflag: '全部', OverTimeflag: '全部', Custom: '', Signflag: '全部', Nucleinflag: '全部', Exceptionflag: '全部' }), (ListSearchpattype = '全部'), (ListSearchOtherflag = '全部')">清
                                        除</el-button>
                                      <el-button @click.native="CancelFilter()">取 消</el-button>
                                    </div>
                                  </td>
                                </tr>
                              </table>
                            </div>
                            <el-input slot="reference" v-model="listStatus" style="width: 160px; cursor: pointer" readonly
                              placeholder="请选择过滤条件" suffix-icon="el-icon-arrow-down"></el-input>
                          </el-popover>
                        </td>
                        <td>
                          <el-input v-model="listsearchkey" @keyup.enter.native="listsearch()"
                            ref="listsearchinput"></el-input>
                        </td>
                        <!--<td>
                                                  <table>
                                                      <tr>
                                                          <td style="text-align:left">
                                                              <el-dropdown>
                                                                  <span class="el-dropdown-link">
                                                                      <i class="el-icon-arrow-down el-icon--right"></i>
                                                                  </span>
                                                                  <el-dropdown-menu slot="dropdown">
                                                                      <el-dropdown-item>
                                                                          <el-checkbox v-model="pagebylist">根据列表翻页</el-checkbox>
                                                                      </el-dropdown-item>
                                                                      <el-dropdown-item>
                                                                          <el-checkbox v-model="myreport">{{myreportname}}</el-checkbox>
                                                                      </el-dropdown-item>
                                                                  </el-dropdown-menu>
                                                              </el-dropdown>
                                                          </td>
                                                      </tr>
                                                  </table>
                                              </td>-->
                      </tr>
                    </table>
                  </div>
                </template>
                <div :style="{ height: showpagenation ? 'calc(100% - 35px)' : '100%' }">
                  <vxe-table :data="tableDataListS" @cell-click="currentListClick"
                    :edit-config="{ trigger: 'click', mode: 'cell', showStatus: false, showIcon: false }"
                    @edit-actived="DataActive" @edit-closed="MarkClose" @select-change="currentListSelect"
                    @current-change="currentListChangeEvent" @cell-dblclick="ListDblClick"
                    @header-cell-click="ListSortChange" @sort-change="ListSortChangedEvent"
                    :row-custom-style="ListStyleName" :select-config="selectConfig"
                    :optimization="{ scrollY: { gt: 100 } }" :keyboard-config="keyConfig"
                    :sort-config="{ trigger: 'cell' }" height="100%" highlight-current-row ref="xTableList" resizable
                    highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip"
                    header-align="center" :loading="loadingList" size="mini" width="800px" :config-record-key="ListKey">
                    <vxe-table-column type="selection" title="选择" width="60px" v-if="Begincheckmode"
                      align="center"></vxe-table-column>
                    <vxe-table-column field="cp_msg" title="审核消息提示" width="90px" v-if="Begincheckmode" align="center">
                      <template v-slot="{ row }">
                        <div @dblclick="checkmodeDbl(row)"
                          :style="{ color: row.cp_msg && row.cp_msg.indexOf('失败') > -1 ? 'red' : 'black' }">{{ row.cp_msg
                          }}</div>
                      </template>
                    </vxe-table-column>
                    <vxe-table-column field="markno" title="标" width="20px" align="center"
                      v-if="Options.showremarkcol == '1'" :edit-render="{ name: 'input' }">
                      <template v-slot="{ row }">
                        <div v-if="row.markno != '' && row.markno != null" style="cursor: pointer">标</div>
                        <div v-else style="width: 20px; height: 25px"></div>
                      </template>
                      <template v-slot:edit="{ row }">
                        <div>
                          <div tabindex="0" @focus="Markfocus(row)" style="height: 24px" ref="markdiv">{{ row.markno != ""
                            && row.markno != null ? "标" : " " }}</div>
                          <!-- <el-input v-model="row.markno" @focus="Markfocus(row)" readonly clearable></el-input> -->
                          <div ref="selectDialog" class="reqitem-dialog" v-show="markvisible"
                            style="min-width: 300px; max-width: 500px; background-color: white; border: 1px solid #ccc">
                            <div class="reqitem-select">
                              <el-collapse v-model="collapsearr">
                                <el-collapse-item title="复查标记" name="1" disabled>
                                  <template slot="title">
                                    <span style="padding-left: 5px">复查标记</span>
                                    <div :style="'color: red;padding-left:' + (196 - mredoflagname.length * 12) + 'px'">{{
                                      mredoflagname }}</div>
                                  </template>
                                  <div>
                                    <div style="padding-left: 10px">
                                      <div style="padding-right: 10px; width: 80px; float: left; padding-bottom: 10px">
                                        <el-tag type="" @click="tagclick('1', '需复查', 'redoflag', row)"
                                          :effect="mredoflag == '1' ? 'dark' : 'plain'"
                                          style="cursor: pointer">需复查</el-tag>
                                      </div>
                                      <div style="padding-right: 10px; width: 80px; float: left; padding-bottom: 10px">
                                        <el-tag type="" @click="tagclick('2', '已复查', 'redoflag', row)"
                                          :effect="mredoflag == '2' ? 'dark' : 'plain'"
                                          style="cursor: pointer">已复查</el-tag>
                                      </div>
                                    </div>
                                    <!-- <el-radio-group v-model="mredoflag" style="padding-left: 29px;width:calc(100% - 55px);text-align:left" :disabled="row.rechkflag == '9' || (Options.onlymodifymyreport == '1' && $tool.getSession(this.$tool.loginuserno) != PatientInfo['report_user']) || (row.barcode != null && row.barcode != '' && row.barcode.indexOf('-退') > -1)">
                                                                          <el-radio label="1">需复查</el-radio>
                                                                          <el-radio label="2">已复查</el-radio>
                                                                      </el-radio-group> -->
                                  </div>
                                </el-collapse-item>

                                <el-collapse-item title="特殊病人标记" name="2" disabled>
                                  <template slot="title">
                                    <span style="padding-left: 5px">特殊病人标记</span>
                                    <div
                                      :style="'color: red;padding-left:' + (180 - mspecialflagname.length * 13) + 'px'">{{
                                        mspecialflagname }}</div>
                                    <el-link @click="ChangeMark(2)" v-show="mspecialflagname.length > 0"><i
                                        class="el-icon-close"></i></el-link>
                                  </template>
                                  <div style="padding-left: 10px">
                                    <div v-for="item in specialpattypes" :key="item.specialtype"
                                      style="padding-right: 10px; width: 80px; float: left; padding-bottom: 10px">
                                      <el-tag type=""
                                        @click="tagclick(item.specialtype, item.specialtypename, 'specialtype', row)"
                                        :effect="item.specialtype == mspecialflag ? 'dark' : 'plain'"
                                        style="cursor: pointer">{{ item.specialtypename }}</el-tag>
                                    </div>
                                  </div>
                                  <!-- <div style="width:100%;text-align:right;padding-right: 5px">
                                                                      <el-button @click="MarkClose({ row }, 3)">非特殊病人</el-button>
                                                                  </div> -->
                                </el-collapse-item>
                                <el-collapse-item title="自定义标记" name="3" disabled>
                                  <template slot="title">
                                    <span style="padding-left: 5px">自定义标记</span>
                                    <div :style="'color: red;padding-left:' + (186 - mmarkflag.length * 12) + 'px'">{{
                                      mmarkflag }}</div>
                                    <el-link @click="ChangeMark(3)" v-show="mmarkflag.length > 0"><i
                                        class="el-icon-close"></i></el-link>
                                  </template>
                                  <div style="padding-left: 10px">
                                    <div v-for="item in reportmarks" :key="item.value"
                                      style="padding-right: 10px; width: 80px; float: left; padding-bottom: 10px">
                                      <el-tag type="" @click="tagclick(item.label, item.label, 'mark', row)"
                                        :effect="item.label == mmarkflag ? 'dark' : 'plain'" style="cursor: pointer">{{
                                          item.label }}</el-tag>
                                    </div>
                                  </div>
                                  <el-input v-model="mmarkflag" style="padding-left: 10px"
                                    :disabled="row.rechkflag == '9' || (Options.onlymodifymyreport == '1' && $tool.getSession(this.$tool.loginuserno) != PatientInfo['report_user']) || (row.barcode != null && row.barcode != '' && row.barcode.indexOf('-退') > -1)"
                                    type="textarea" :rows="3"></el-input>
                                  <!-- <div style="width:100;text-align:right;padding-top:5px;padding-right: 5px">
                                                                      <el-button @click="MarkClose({ row }, 1)">确定</el-button>
                                                                      <el-button @click="markvisible = false">取消</el-button>
                                                                      <el-button @click="MarkClose({ row }, 2)">删除标记</el-button>
                                                                  </div> -->
                                </el-collapse-item>
                              </el-collapse>
                              <!-- <div style="width: 100%">
                                                              <span style="font-weight:bold">特殊病人标记</span>
                                                              <el-radio-group v-model="mspecialflag" style="padding-left: 5px;width:calc(100% - 77px);text-align:left">
                                                                  <el-radio v-for="item in specialpattypes" :key="item.specialtype" :label="item.specialtype">{{ item.specialtypename }}</el-radio>
                                                              </el-radio-group>
                                                          </div>
                                                          <el-divider></el-divider>

                                                          <span style="font-weight:bold">标记内容</span>
                                                          <el-input v-model="mmarkflag" style="padding-left: 29px;width:calc(100% - 55px)" :disabled="row.rechkflag == '9' || (Options.onlymodifymyreport == '1' && $tool.getSession(this.$tool.loginuserno) != PatientInfo['report_user']) || (row.barcode != '' && row.barcode.indexOf('-退') > -1)"></el-input>
                                                          <span style="font-weight:bold">自定义标记</span>
                                                          <el-radio-group v-model="mmarkflag" style="padding-left: 17px;width:calc(100% - 65px);text-align:left" :disabled="row.rechkflag == '9' || (Options.onlymodifymyreport == '1' && $tool.getSession(this.$tool.loginuserno) != PatientInfo['report_user']) || (row.barcode != '' && row.barcode.indexOf('-退') > -1)">
                                                              <el-radio v-for="item in reportmarks" :key="item.value" :label="item.label" :value="item.label"></el-radio>
                                                          </el-radio-group> -->
                            </div>
                          </div>
                        </div>

                        <!-- <el-popover placement="bottom" width="550" trigger="click" v-model="markvisible">
                                                  <div>
                                                      <el-input v-model="row.markno"></el-input>
                                                      <el-radio-group v-model="row.markno">
                                                          <el-radio v-for="item in reportmarks" :key="item.value" :label="item.label"></el-radio>
                                                      </el-radio-group>
                                                  </div>
                                                  <el-input slot="reference" v-model="row.markno" style="cursor:pointer" readonly></el-input>
                                              </el-popover> -->
                      </template>
                    </vxe-table-column>
                    <vxe-table-column field="exceptionflag" title="异" width="20px" align="center"
                      v-if="Options.showmultiitemrule == '1'" :edit-render="{ name: 'input' }">
                      <template v-slot="{ row }">
                        <div v-if="row.exceptionflag && row.exceptionflag == '1'" style="cursor: pointer;color:red;">异
                        </div>
                        <div v-else style="width: 20px; height: 25px"></div>
                      </template>
                      <template v-slot:edit="{ row }">
                        <div>
                          <div tabindex="0" @focus="Exceptionfocus(row)" @blur="Exceptionblur()"
                            style="height: 24px;color:red;" ref="exceptiondiv">{{ row.exceptionflag && row.exceptionflag
                              == '1' ? "异" : " " }}</div>
                          <div ref="selectDialog" class="reqitem-dialog"
                            v-show="row.exceptionflag && row.exceptionflag == '1' && exceptionvisible"
                            style="min-width: 300px; max-width: 500px; background-color: white; border: 1px solid #ccc">
                            <div class="reqitem-select">
                              <vxe-table :data.sync="multiitemData" border fit height="400px" header-align="center"
                                highlight-current-row highlight-hover-row ref="xTableItemH" resizable
                                show-header-overflow="tooltip" show-overflow="tooltip" size="mini" status-msg-group="none"
                                stripe>
                                <vxe-table-column field="actiontype" title="操作类别" width="80px"
                                  align="center"></vxe-table-column>
                                <vxe-table-column field="sampleno" title="报告项目" width="100px" align="center">
                                  <template v-slot="{ row }">
                                    <span>{{ row.rpt_itemname + '[' + row.itemcode_en + ']' }}</span>
                                  </template>
                                </vxe-table-column>
                                <vxe-table-column field="describe" title="提示说明" width="180px"
                                  align="center"></vxe-table-column>
                              </vxe-table>
                            </div>
                          </div>
                        </div>
                      </template>
                    </vxe-table-column>
                    <vxe-table-column :field="item.field" :title="item.title" :width="item.width"
                      v-for="item in tableListColumn" sortable v-bind:key="item.field"
                      :align="item.field == 'pat_sexname' || item.field == 'pat_agestr' || item.field == 'redo_flag' || item.field == 'alter_flag' || item.field == 'emer_flag' || item.field == 'rechkflag' || item.field == 'printflag' || item.field == 'sampleno' || item.field == 'strsampledate' || item.field == 'pat_name' || item.field == 'rptunitno' ? 'center' : 'left'"
                      header-align="center" :sort-width="item.field == 'sampleno' ? 20 : 0">
                      <template
                        v-if="item.field == 'redo_flag' || item.field == 'alter_flag' || item.field == 'emer_flag' || item.field == 'rechkflag' || item.field == 'printflag' || item.field == 'germ_flag' || item.field == 'overtimeflag' || item.field == 'special_flag'"
                        v-slot="{ row }">
                        <div v-if="item.field == 'alter_flag' && row.alter_flag > 0"
                          v-bind:style="{ background: Options.alertflagcolor ? Options.alertflagcolor : 'red', height: '25px' }">
                          <span v-bind:style="{ color: 'black' }">{{ item.title }}</span>
                        </div>
                        <div v-else-if="item.field == 'redo_flag' && row.redo_flag > 0"
                          v-bind:style="{ background: row.redo_flag == '2' ? 'rgb(00, 255, 00)' : Options.redoflagcolor ? Options.redoflagcolor : 'yellow', height: '25px' }">
                          <span v-bind:style="{ color: 'black' }">{{ item.title }}</span>
                        </div>
                        <div v-else-if="item.field == 'modify_flag' && row.modify_flag == '1'"
                          v-bind:style="{ background: Options.modifyflagcolor ? Options.modifyflagcolor : '#FFFFFF', height: '25px' }">
                          <span v-bind:style="{ color: 'black' }">{{ item.title }}</span>
                        </div>
                        <div v-else-if="item.field == 'emer_flag' && row.emer_flag > 0">
                          <span v-bind:style="{ color: 'red' }">{{ item.title }}</span>
                        </div>
                        <div
                          v-else-if="item.field == 'rechkflag' && row.rechkflag == '9' && row.autocheckflag && row.autocheckflag == '1'">
                          <span v-bind:style="{ color: 'red', fontSize: '14px' }">自</span></div>
                        <div v-else-if="item.field == 'rechkflag' && row.rechkflag == '9'">
                          <span v-bind:style="{ color: 'black' }">{{ item.title }}</span>
                        </div>
                        <div
                          v-else-if="item.field == 'rechkflag' && row.rechkflag == '1' && row.autosignflag && row.autosignflag == '1'">
                          <span v-bind:style="{ color: 'black', fontSize: '14px' }">自</span></div>
                        <div v-else-if="item.field == 'rechkflag' && row.rechkflag == '1'"><span
                            v-bind:style="{ color: 'black' }">签</span></div>
                        <div v-else-if="item.field == 'rechkflag' && row.barcode && row.barcode.indexOf('-退') > -1"
                          style="background-color: purple"><span v-bind:style="{ color: 'white' }">退</span></div>
                        <div v-else-if="item.field == 'rechkflag' && row.prechkflag == '1'"><span
                            v-bind:style="{ color: 'black' }">待</span></div>
                        <div v-else-if="item.field == 'rechkflag' && row.prechkflag != '1' && row.prechkflag != '0'"><span
                            v-bind:style="{ color: 'black' }">{{ row.prechkflag }}</span></div>
                        <div v-else-if="item.field == 'printflag' && row.printflag > 0">
                          <span v-bind:style="{ color: 'black' }">{{ item.title }}</span>
                        </div>
                        <div v-else-if="item.field == 'germ_flag'">
                          <span
                            v-bind:style="{ color: row.germ_flag == '2' || row.germ_flag == 'P' || (row.germ_flag ? row.germ_flag.indexOf('阳性') > -1 : false) ? 'red' : 'black' }">{{
                              row.germ_flag }}</span>
                        </div>
                        <div v-else-if="item.field == 'overtimeflag' && row.overtimeflag == '1'"><span
                            v-bind:style="{ color: 'red' }">超</span></div>
                        <div v-else-if="item.field == 'special_flag' && row.special_flag"
                          v-bind:style="{ backgroundColor: row.special_color }"><span>{{ row.special_flag }}</span></div>
                        <div v-else></div>
                      </template>
                      <template v-else-if="item.field == 'pat_name'" v-slot="{ row,column }">
                        <div :style="ReportListClass(row, column.property)">{{ row[item.field] }}</div>
                      </template>
                      <template v-else-if="item.field == 'req_groupname'" v-slot="{ row,column }">
                        <div :style="ReportListClass(row, column.property)">{{ row[item.field] }}</div>
                      </template>
                    </vxe-table-column>
                    <template v-slot:fix>
                      <div v-if="Begincheckmode"
                        style="height: 190px; background-color: white; border: 1px solid #ccc; border-spacing: 0px 5px"
                        class="checkmodeclass">
                        <div style="height: 20px; pading-bottom: 3px">
                          <span style="color: blue; font-weight: bold">{{ batsignmode == "0" ? "终审" : "初审" }}</span>提示:
                          已选择报告数: <span style="color: blue; font-weight: bold">{{ CheckRows.length }}</span> 成功: <span
                            style="color: blue; font-weight: bold">{{ checksuccess }}</span>失败: <span
                            style="color: red; font-weight: bold">{{ checkfail }}</span>
                        </div>
                        <table style="width: 100%; border-spacing: 0px 5px">
                          <tr>
                            <td style="width: 50px; padding-right: 5px">检验意见</td>
                            <td>
                              <el-input type="textarea" :rows="2" v-model="PatientInfo.lab_advice"
                                @dblclick.native="inputdblEvent('lab_advice')" @focus="Checkmodefocus"
                                @blur="Checkmodeblur"></el-input>
                            </td>
                          </tr>
                          <tr>
                            <td style="width: 50px; padding-right: 5px">报告备注</td>
                            <td>
                              <el-input type="textarea" :rows="2" v-model="PatientInfo.report_commname"
                                @dblclick.native="inputdblEvent('report_comm')" @focus="Checkmodefocus"
                                @blur="Checkmodeblur"></el-input>
                            </td>
                          </tr>
                          <tr>
                            <td style="width: 50px; padding-right: 5px">临床诊断</td>
                            <td>
                              <el-input type="textarea" :rows="2" v-model="PatientInfo.pat_diag" @focus="Checkmodefocus"
                                @blur="Checkmodeblur"></el-input>
                            </td>
                          </tr>
                        </table>
                      </div>
                      <div style="font-size: 12px; padding-top: 3px; background-color: #fff">
                        <span style="color: green; margin-left: 60px">审:{{ ExactNum }} </span><span
                          style="color: blue; margin-left: 5px"> 未审:{{ UnExactNum }}</span>
                        <span style="color: blue; margin-left: 60px">{{ NowPatNum }}/{{ TotalPatNum }}</span>
                        <span style="color: #cc9900; margin-left: 30px">待复查: {{ NeedRedoNum }}</span>
                        <span style="color: green; margin-left: 5px">已复查: {{ HasRedoNum }}</span>
                        <span style="color: red; margin-left: 5px">已超时: {{ HasOverTimeNum }}</span>
                      </div>
                    </template>
                  </vxe-table>
                </div>

                <vxe-pager :loading="loadingList" :current-page="tableListPage.currentPage"
                  :page-size="tableListPage.pageSize" :total="tableListPage.totalResult"
                  :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
                  :page-sizes="[100, 500, 1000, 3000, 5000]" @page-change="handlePageChange"
                  v-if="showpagenation"></vxe-pager>
              </rm-layout-top>
            </el-tab-pane>

            <el-tab-pane v-if="Tablist.split(',').indexOf('2') > -1" label="图像" name="2" key="2"
              :style="{ overflowY: 'auto', '--basecolor': basecolor }">
              <span style="color: blue">当前标本号{{ specno }}:【{{ selectdate }}】</span>
              <div v-for="(image, index) in ImageList" :key="index" v-show="!ConfigDetail.set_imgget" class="basecolor">
                <el-image style="width: 200px; height: 120px; z-index: auto" :src="image.url" fit="contain"
                  :preview-src-list="[selectclearimage]" @contextmenu.prevent="RightClickImage($event, image.name)"
                  @click="ShowClearImage(image.name, image.seq)"></el-image>
                <div style="width: 200px; text-align: center">{{ image.name }}</div>
              </div>
              <div style="width: 100%; height: calc(100% - 175px)" v-show="ConfigDetail.set_imgget" class="basecolor">
                <el-image :src="selectimage" :preview-src-list="[selectclearimage]" title="点击查看清晰图片"
                  style="width: 100%; height: 100%; z-index: auto" fit="contain"
                  @click="ShowClearImage(selectname, selectseq)">
                  <div slot="error" style="height: 100%; text-align: center"></div>
                </el-image>
              </div>
              <div style="width: 100%; height: 150px; border: 1px solid #ccc; margin-top: 5px; overflow-x: auto"
                v-show="ConfigDetail.set_imgget">
                <table style="width: 100%">
                  <tr>
                    <td>
                      <el-button @click="ImageCommSelect()" :disabled="UpdateJudge()">选择</el-button>
                    </td>
                    <td>
                      <el-input style="width: 100%; display: inline" v-model="imagecomm" @input="imagecomminput"
                        :disabled="UpdateJudge()"></el-input>
                    </td>
                  </tr>
                </table>
                <table style="height: 85px">
                  <tr>
                    <td v-for="(image, index) in ImageList" :key="index" style="text-align: left">
                      <div @click="imagechange(image, index)"
                        :style="{ border: ImageIndex[index] ? '1px solid red' : '1px solid white' }">
                        <el-image style="width: 100px; height: 80px; z-index: auto" :src="image.url"></el-image>
                      </div>
                    </td>
                  </tr>
                </table>
                <table class="upload-img">
                  <tr>
                    <td>
                      <el-upload class="upload-demo" action="" :auto-upload="true" accept="image/*"
                        :show-file-list="false" :http-request="uploadimage" :disabled="UpdateJudge()">
                        <el-button size="small">新增</el-button>
                      </el-upload>
                    </td>
                    <td class="upload-demo">
                      <el-button @click="DelImage()">删除</el-button>
                    </td>
                    <td class="upload-demo">
                      <el-button @click="OpenCatchImage()">捕获</el-button>
                    </td>
                    <td class="upload-demo">
                      <el-button @click="ExportImage()">导出</el-button>
                    </td>
                    <td class="upload-demo">
                      <el-button @click="Changeimageseq(3)" style="width: 35px">&lt;&lt;</el-button>
                    </td>
                    <td class="upload-demo">
                      <el-button @click="Changeimageseq(1)" style="width: 35px">&lt;</el-button>
                    </td>
                    <td class="upload-demo">
                      <el-button @click="Changeimageseq(0)" style="width: 35px">&gt;</el-button>
                    </td>
                    <td class="upload-demo">
                      <el-button @click="Changeimageseq(2)" style="width: 35px">&gt;&gt;</el-button>
                    </td>
                  </tr>
                </table>
                <!-- <table style="width:100%">
                                  <tr>
                                      <td>
                                          <el-button @click="dialogAdviceVisible = true,advicetype = '2',advicetxt = imagecomm">选择</el-button>
                                      </td>
                                      <td>
                                          <el-input style="width:100%;display:inline" v-model="imagecomm" @input="imagecomminput"></el-input>
                                      </td>
                                  </tr>
                              </table>
                              <el-upload
                                  class="upload-demo"
                                  action=""
                                  list-type="picture-card"
                                  accept="image/*"
                                  :on-preview="handlePreview"
                                  :on-remove="handleRemove"
                                  :on-progress="handleProgress"
                                  :file-list="ImageList"
                                  ref="imgupload">
                              </el-upload>
                              <table>
                                      <tr>
                                          <td>
                                              <el-button @click="AddImage()">新增</el-button>
                                              <el-button @click="DelImage()">删除</el-button>
                                          </td>
                                      </tr>
                                  </table> -->
              </div>
            </el-tab-pane>

            <el-tab-pane v-if="Tablist.split(',').indexOf('3') > -1" :label="HistoryTitle" key="3"
              :name="showPatHistoryNum > 0 ? 'TabColorH' : '3'">
              <div style="width: 100px; text-align: center; vertical-align: top; position: absolute;height:100%;"
                @contextmenu.prevent="LinkItemRightClick">
                <el-button style="width: 100px" @click="ShowInfoHistory()">{{ ShowButtonHistory }}病人信息</el-button>
                <!-- <span style="padding-top:2px;padding-bottom:2px;font-size: 14px">结果类别</span> -->
                <!-- <el-menu default-active="1" style="padding-bottom: 5px; width: 100px">
                                  <el-menu-item v-for="(item, index) in HistoryLeftList" :key="item.Item1" :index="index + 1 + ''" @click="menuSelect" :style="index < HistoryLeftList.length - 1 ? 'border-bottom: 1px solid #bbb' : ''">
                                      <span slot="title" style="font-size: 12px">{{ item.Item1 }}</span>
                                  </el-menu-item>
                              </el-menu> -->
                <vxe-table :data="HistoryLeftList" :select-config="selectConfig" :keyboard-config="keyConfig"
                  @current-change="currentHistoryChangeEvent" :cell-class-name="HistoryResultClassName"
                  highlight-current-row ref="xTableHistoryTab" resizable highlight-hover-column border
                  :show-header="false" show-overflow="tooltip" header-align="center" size="mini" max-height="90%">
                  <vxe-table-column prop="Item1" align="center" sortable>
                    <template v-slot="{ row }">
                      <span v-if="row.Item2.indexOf('-') > -1">{{ row.Item1 }}</span>
                      <span v-else><i class="el-icon-s-unfold"
                          style="float: left;margin-top:6px;margin-left:5px;"></i>{{ row.Item1 }}</span>
                    </template>
                  </vxe-table-column>
                </vxe-table>
                <el-button style="width: 100px" @click="
                  (dialogHistoryVisible = true),
                  $nextTick(() => {
                    DrawCharts('dialoghistoryChart');
                  })
                  ">全部信息</el-button>
              </div>
              <div v-show="GermHistoryflag"
                style="width: calc(100% - 100px); left: 100px; position: absolute; height: 100%">
                <div style="width: calc(100% - 100px); left: 100px;height:30px; padding-left:10px;">
                  <rm-ddl-rptunit :prgno="PRGNO" :multiple_choice="true" clearable v-model="selrptunitlist" width="100%"
                    @change="rptunitchange" @keyup.enter.native="EnterRptunitChange()"></rm-ddl-rptunit>
                </div>
                <div style="height: calc(100% - 250px)">
                  <div v-if="PRGNO == 'LIS311'" style="width:100%;height:30px;">
                    <span class="search-param__text">
                      <el-checkbox-group v-model="searchgermflag" style="width: 295px;margin-left: 10px;"
                        @change="germflagChange()">
                        <el-checkbox label="1">阴性结果</el-checkbox>
                        <el-checkbox label="2">阳性菌</el-checkbox>
                        <el-checkbox label="3">正常菌种</el-checkbox>
                        <el-checkbox label="4">涂片结果</el-checkbox>
                      </el-checkbox-group>
                    </span>
                  </div>
                  <div style="height: calc(100% - 30px)">
                    <vxe-table :data="tableDataHistory" @current-change="CurrentHistoryChange"
                      :cell-class-name="ColumnClassNameHistory" @cell-dblclick="GermHistoryDblEvent"
                      :select-config="selectConfig" :keyboard-config="keyConfig" height="auto" highlight-current-row
                      highlight-hover-row ref="xTableHistory" resizable highlight-hover-column border
                      show-header-overflow="tooltip" show-overflow="tooltip" header-align="center"
                      :loading="loadingHistory" size="mini" stripe width="auto" class="ResultTable">
                      <vxe-table-column field="rpt_itemname" title="检验项目" width="100px"></vxe-table-column>
                      <vxe-table-column field="result_str" title="检验结果" width="70px"></vxe-table-column>
                      <vxe-table-column field="result1" title="菌落计数" width="60px"></vxe-table-column>
                      <vxe-table-column field="result4" title="耐药机制" width="60px"></vxe-table-column>
                      <vxe-table-column field="sampledate" title="标本日期" width="90px" align="center"></vxe-table-column>
                      <vxe-table-column field="sampleno" title="标本编号" width="100px"></vxe-table-column>
                      <vxe-table-column field="specimen_codename" title="标本类型" width="60px"
                        align="center"></vxe-table-column>
                      <vxe-table-column field="rptunitname" title="报告单元" width="60px"></vxe-table-column>
                      <vxe-table-column field="pat_name" title="病人姓名" width="60px" align="center"></vxe-table-column>
                      <vxe-table-column field="pat_no" title="病人号" width="70px"></vxe-table-column>
                      <vxe-table-column field="pat_sexname" title="性别" width="40px" align="center"></vxe-table-column>
                      <vxe-table-column field="rechk_username" title="审核医生" width="60px"></vxe-table-column>
                      <vxe-table-column field="rechk_dt" title="审核时间" width="80px"></vxe-table-column>
                      <vxe-table-column field="alertflag" title="警告" width="40px" align="center"></vxe-table-column>
                      <vxe-table-column field="emer_flag" title="加急" width="40px" align="center">
                        <template v-slot="{ row }">
                          <div v-if="row.emer_flag > 0"><span v-bind:style="{ color: 'red' }">急</span></div>
                          <div v-else></div>
                        </template>
                      </vxe-table-column>
                      <vxe-table-column field="rechkflag" title="审核" width="40px" align="center">
                        <template v-slot="{ row }">
                          <div v-if="row.rechkflag == '9'"><span v-bind:style="{ color: 'black' }">审</span></div>
                          <div v-else-if="row.rechkflag == '1'"><span v-bind:style="{ color: 'black' }">签</span></div>
                          <div v-else-if="row.prechkflag == '1'"><span v-bind:style="{ color: 'black' }">待</span></div>
                          <div v-else></div>
                        </template>
                      </vxe-table-column>
                      <vxe-table-column field="print_count" title="打印次数" width="60px" align="right"
                        header-align="center"></vxe-table-column>
                      <vxe-table-column field="pat_agestr" title="年龄" width="40px"></vxe-table-column>
                      <vxe-table-column field="req_bedno" title="床号" width="40px"></vxe-table-column>
                    </vxe-table>
                  </div>
                </div>
                <div style="width: 100%; height: 220px; vertical-align: center; border: 1px solid #ccc; margin-top: 2px">
                  <vxe-table :data="tableDataHistoryMed" :select-config="selectConfig" :keyboard-config="keyConfig"
                    height="auto" highlight-current-row ref="xTableHistoryMed" resizable highlight-hover-column border
                    show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" :loading="loadingHistory"
                    size="mini" stripe width="auto">
                    <vxe-table-column type="index" title="NO." width="40px"></vxe-table-column>
                    <vxe-table-column field="medname" title="抗生素" width="130px"></vxe-table-column>
                    <vxe-table-column field="rad" title="Rad" width="40px"></vxe-table-column>
                    <vxe-table-column field="mic" title="Mic" width="40px"></vxe-table-column>
                    <vxe-table-column field="medresult" title="药敏结果" width="70px"></vxe-table-column>
                    <vxe-table-column field="result_flag" title="结果标志" width="60px"></vxe-table-column>
                    <vxe-table-column field="result6" title="参考范围" width="60px"></vxe-table-column>
                    <vxe-table-column field="medconc" title="药物浓度" width="60px"></vxe-table-column>
                  </vxe-table>
                </div>
              </div>
              <div style="width: calc(100% - 100px); left: 100px; position: absolute; height: 100%"
                v-show="!GermHistoryflag" @contextmenu.prevent="LinkItemRightClick">
                <div style="width: calc(100% - 100px); left: 100px;height:30px; padding-left:10px; ">
                  <rm-ddl-rptunit :prgno="PRGNO" :multiple_choice="true" clearable v-model="selrptunitlist" width="100%"
                    @change="rptunitchange" @keyup.enter.native="EnterRptunitChange()"></rm-ddl-rptunit>
                </div>
                <div :style="CurveShow ? 'height: calc(100% - 250px)' : 'height: calc(100% - 30px)'">
                  <vxe-table :data="tableDataHistory" @current-change="CurrentHistoryChange"
                    @header-cell-dblclick="HistoryTitleDblEvent" @cell-dblclick="HistoryDblEvent"
                    :select-config="selectConfig" :keyboard-config="keyConfig" height="auto" highlight-current-row
                    highlight-hover-row ref="xTableHistory" resizable highlight-hover-column border
                    show-header-overflow="tooltip" header-align="center" :loading="loadingHistory" size="mini" stripe
                    width="auto" class="ResultTable">
                    <vxe-table-column :field="item.field" :title="item.title" :width="item.width"
                      :fixed="item.field == 'rptitem' ? 'left' : ''" :key="item.field" show-overflow
                      v-for="item in tableColumnHistory">
                      <template v-slot="{ row, column }">
                        <div :style="ResultClass(row, column.property)">{{ row[item.field] }}</div>
                      </template>
                    </vxe-table-column>
                  </vxe-table>
                </div>
                <div v-show="!GermHistoryflag && CurveShow">
                  <div id="historyChart"
                    style="width: 100%; height: 220px; vertical-align: center; border: 1px solid #ccc; margin-top: 2px">
                  </div>
                </div>
              </div>
            </el-tab-pane>

            <el-tab-pane v-if="Tablist.split(',').indexOf('4') > -1" name="4" label="输入" key="4">
              <vxe-table :data="tableDataInputMdl" @cell-click="MdlClick" @cell-dblclick="MdlDblClick"
                :select-config="selectConfig" :keyboard-config="keyConfig" height="100%" highlight-current-row
                highlight-hover-row ref="xTableMdl" resizable highlight-hover-column border show-header-overflow="tooltip"
                show-overflow="tooltip" header-align="center" :loading="loadingMdl" size="mini" stripe width="800px">
                <vxe-table-column :field="item.field" :title="item.title" :width="item.width" :key="item.field"
                  v-for="item in tableColumnInputMdl"></vxe-table-column>
              </vxe-table>
            </el-tab-pane>

            <el-tab-pane v-if="Tablist.split(',').indexOf('11') > -1" name="13" label="待检样本" key="13">
              <div style="overflow-y: auto;">
                <el-checkbox-group class="wait-info" v-model="SmpSearchFilter.Stasusflag" size="mini">
                  <table>
                    <tr>
                      <td style="text-align: left; width: 120px">
                        <el-checkbox label="已采样" size="mini"><br /></el-checkbox>
                        <el-input v-model="sampledaysingle1" style="width: 30px"
                          :disabled="SmpSearchFilter.Stasusflag.indexOf('已采样') == -1"> </el-input>
                        <span style="font-size: 12px">天内已采样</span>
                      </td>
                      <td style="text-align: left; width: 120px">
                        <el-checkbox label="已签收" size="mini"><br /></el-checkbox>
                        <el-input v-model="sampledaysingle2" style="width: 30px"
                          :disabled="SmpSearchFilter.Stasusflag.indexOf('已签收') == -1"> </el-input>
                        <span style="font-size: 12px">天内已签收</span>
                      </td>
                      <td style="text-align: left; width: 120px">
                        <el-checkbox label="已生成" size="mini"><br /></el-checkbox>
                        <el-input v-model="sampledaysingle3" style="width: 30px"
                          :disabled="SmpSearchFilter.Stasusflag.indexOf('已生成') == -1"> </el-input>
                        <span style="font-size: 12px">天内已生成</span>
                      </td>
                    </tr>
                    <tr>
                      <td colspan="3" style="text-align: left">
                        <el-checkbox label="门诊" size="mini" style="padding-right: 15px"></el-checkbox>
                        <el-checkbox label="急诊" size="mini" style="padding-right: 15px"></el-checkbox>
                        <el-checkbox label="住院" size="mini" style="padding-right: 15px"></el-checkbox>
                        <el-checkbox label="其他" size="mini" style="padding-right: 15px"></el-checkbox>
                        <el-select v-model="workonmachine" @change="QuerySample()">
                          <el-option value="1" label="未上机"></el-option>
                          <el-option value="2" label="已上机"></el-option>
                          <el-option value="3" label="已上机未审核"></el-option>
                          <el-option value="" label="全部"></el-option>
                        </el-select>
                      </td>
                    </tr>
                    <tr>
                      <td colspan="3" style="text-align: left">
                        申请项目
                        <el-select v-model="reqitem"
                          @dblclick.native="popMultipleChk(reqitem, 'reqitem', reqitemOption, '申请项目选择')"
                          @focus="SelectFocus('reqitem')" :loading="reqitemloading"
                          style="width: calc(100% - 70px); padding-right: 5px" remote filterable clearable>
                          <el-option v-for="(item, index) in reqitemOption" :key="index" :value="item.data"
                            :label="item.display"> </el-option>
                        </el-select>
                      </td>
                    </tr>
                    <tr>
                      <td colspan="3" style="text-align: left">
                        快速查询
                        <el-input v-model="samplesearchtxt" style="width: calc(100% - 75px);"
                          placeholder="可查询姓名条码号等"></el-input>
                      </td>
                    </tr>
                    <tr>
                      <td colspan="3" style="text-align: left">
                        <el-button @click="QuerySample()">刷新</el-button>
                        <el-button @click="CollectToCurSpecno()">核收到当前标本号</el-button>
                      </td>
                    </tr>
                  </table>
                </el-checkbox-group>
              </div>
              <div style="height: calc(100% - 140px); display: block; float: left; padding-top: 5px; width: 100%">
                <vxe-table :data="tableDataSmp" :row-class-name="SmpClassName" :select-config="selectConfig"
                  :keyboard-config="keyConfig" :sort-config="{ trigger: 'cell' }" height="100%" highlight-current-row
                  ref="xTableSmp" resizable highlight-hover-column border show-header-overflow="tooltip"
                  show-overflow="tooltip" header-align="center" :loading="loadingSmp" size="mini" width="100%"
                  @cell-dblclick="SampleToRpt">
                  <vxe-table-column title="No." width="40px" type="index"></vxe-table-column>
                  <vxe-table-column field="emer_flag" title="加急" width="40px" align="center">
                    <template v-slot="{ row }">
                      <div v-if="row.emer_flag > 0"><span v-bind:style="{ color: 'red' }">急</span></div>
                      <div v-else></div>
                    </template>
                  </vxe-table-column>
                  <vxe-table-column field="barcode" title="条码号" width="100px" sortable sort-width="20"></vxe-table-column>
                  <vxe-table-column field="pat_name" title="姓名" width="60px" align="center" sortable></vxe-table-column>
                  <vxe-table-column field="pat_agestr" title="年龄" width="50px" align="center" sortable></vxe-table-column>
                  <vxe-table-column field="pat_sexname" title="性别" width="40px" align="center"
                    sortable></vxe-table-column>
                  <vxe-table-column field="pat_typecodename" title="病人类型" width="60px" align="center"
                    sortable></vxe-table-column>
                  <vxe-table-column field="pat_no" title="病人号" width="80px" align="center" sortable></vxe-table-column>
                  <vxe-table-column field="req_groupna" title="分单类别" width="80px" align="center"
                    sortable></vxe-table-column>
                  <vxe-table-column field="sample_items" title="项目描述" width="140px" sortable></vxe-table-column>
                  <vxe-table-column field="req_statname" title="状态" width="60px" sortable></vxe-table-column>
                  <vxe-table-column field="deptname" title="申请科室" width="100px" sortable></vxe-table-column>
                  <vxe-table-column field="pathospitalname" title="所属医院" width="100px" sortable></vxe-table-column>
                  <vxe-table-column field="recieve_dt" title="接收时间" width="120px" sortable></vxe-table-column>
                  <vxe-table-column field="req_dt" title="申请时间" width="120px" sortable></vxe-table-column>
                  <vxe-table-column field="prereport_dt" title="预出报告时间" width="120px" sortable></vxe-table-column>
                  <vxe-table-column field="sampled_dt" title="采样时间" width="120px" sortable></vxe-table-column>
                  <template v-slot:fix>
                    <div
                      style="width: 100%; text-align: right; color: blue; padding-right: 20px; background-color: white">
                      合计:{{ tableDataSmpCount }}</div>
                  </template>
                </vxe-table>
              </div>
            </el-tab-pane>

            <el-tab-pane v-if="Tablist.split(',').indexOf('5') > -1" name="5" label="申请" key="5">
              <rmLabReportReq :PatientInfo="PatientInfo" :specno="specno" :rptunitid="rptunitid" :Options="Options"
                requesturl="LIS/LIS3/LIS310" @reqtorptitem="ReqChangeSubmit" @reqchange="QueryApplyItem"
                @addreqitembypatno="SavePatInfoByReq" :shift="shiftl" ref="reqitemdialog" style="height: 50%">
              </rmLabReportReq>
              <!-- <div style="height:50%" @dblclick="reqdbleclick('2')">
                              <div v-show="Options && Options.reqtabnoreqitems == '0'" style="position:fixed;z-index:2007;top:300px;padding-left:100px;max-width:400px"><span style="color:pink">{{reqitemlist}}</span></div>

                              <vxe-table :data="tableDataApplyUp" @current-change="ApplyChange" :select-config="selectConfig" :keyboard-config="keyConfig" height="100%" highlight-current-row highlight-hover-row ref="xTableApplyUp" resizable highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" :loading="loadingMdl" size="mini" stripe width="800px">
                                  <vxe-table-column type="index" title=" " width="40" align="center"></vxe-table-column>
                                  <vxe-table-column :field="item.field" :title="item.title" :width="item.width" :key="item.field" v-for="item in tableColumnApplyUp"></vxe-table-column>
                                  <template v-slot:fix>
                                      <div style="padding-right: 50px;background-color:#fff;text-align:right;"><span style="color:blue;font-size:8px;padding-right:20px">项目数: {{ reqnum }}</span><span style="color:blue;font-size:8px">金额: {{ reqamount }}</span></div>
                                  </template>
                              </vxe-table>
                          </div> -->
              <div style="height: 50%">
                <el-tabs v-model="reqitemtabvalue" type="border-card" class="ReqTab" style="height: 100%">
                  <el-tab-pane label="报告明细" name="a" key="a">
                    <vxe-table :data="tableDataApplyDown" :select-config="selectConfig" :keyboard-config="keyConfig"
                      highlight-current-row highlight-hover-row ref="xTableApplyDown" resizable highlight-hover-column
                      border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center"
                      :loading="loadingMdl" size="mini" stripe width="800px" height="100%"
                      :row-class-name="ApplyDownClass">
                      <vxe-table-column :field="item.field" :title="item.title" :width="item.width" :key="item.field"
                        :align="item.align" v-for="item in tableColumnApplyDown">
                      </vxe-table-column>
                    </vxe-table>
                  </el-tab-pane>
                  <el-tab-pane label="收费明细" name="b" key="b">
                    <vxe-table :data="tableDataApplyFee" :select-config="selectConfig" :keyboard-config="keyConfig"
                      highlight-current-row highlight-hover-row ref="xTableApplyDown2" resizable highlight-hover-column
                      border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center"
                      :loading="loadingMdl" size="mini" stripe width="800px" height="100%" style="height: 100%">
                      <vxe-table-column field="feeitemname" title="对应收费项目" width="260px"></vxe-table-column>
                      <vxe-table-column field="item_price" title="价格" width="60px"></vxe-table-column>
                      <vxe-table-column field="qty" title="数量" width="60px"></vxe-table-column>
                      <vxe-table-column field="seq" title="序号" width="40px"></vxe-table-column>
                      <vxe-table-column field="feeitemcode" title="收费项目代码" width="120px"></vxe-table-column>
                    </vxe-table>
                  </el-tab-pane>
                </el-tabs>
              </div>
            </el-tab-pane>

            <el-tab-pane v-if="Tablist.split(',').indexOf('6') > -1" label="复查" :name="Patredoflag ? 'TabColorR' : '6'"
              key="6">
              <div style="height: 30%">
                <vxe-table :data="tableDataRechk" :select-config="selectConfig" :keyboard-config="keyConfig"
                  @current-change="CurrentRechkChange" @cell-dblclick="RechkDblClick" height="100%" highlight-current-row
                  highlight-hover-row ref="xTableRechk" resizable highlight-hover-column border
                  show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" :loading="loadingRechk"
                  size="mini" stripe width="800px">
                  <vxe-table-column field="datestr" title="复查时间(双击可采用本次结果)" width="200px"
                    key="datestr"></vxe-table-column>
                  <vxe-table-column field="cnt" title="次数" width="80px" key="cnt"></vxe-table-column>
                </vxe-table>
                <template>
                  <div style="overflow: hidden;position: absolute;left:20px;top:25%;z-index: 1;width: 100px;">
                    <el-button @click="BeforeRechkDetailDelete(1)" class="el-button--310">删除本次结果</el-button>
                  </div>
                </template>
              </div>
              <div v-if="canUpdateRedoResultflag" style="height: 69%; padding-top: 5px">
                <vxe-table :data="tableDataRechkDetail" :select-config="selectConfig" :keyboard-config="keyConfig"
                  :edit-config="{ trigger: 'click', mode: 'cell', showStatus: false }" fit
                  @cell-dblclick="RechkDetailDblClick" height="100%" highlight-current-row highlight-hover-row
                  ref="xTableRechkDetail" resizable highlight-hover-column border show-header-overflow="tooltip"
                  show-overflow="tooltip" header-align="center" :loading="loadingRechkDetail" size="mini" stripe
                  width="800px">
                  <vxe-table-column field="itemcode_en" sortable title="英文缩写" width="100"></vxe-table-column>
                  <vxe-table-column field="rpt_itemname" sortable title="项目名称" width="180"></vxe-table-column>
                  <vxe-table-column field="newvalue" sortable title="复查后结果" width="100"></vxe-table-column>
                  <vxe-table-column field="oldvalue" sortable title="复查前结果" width="100"
                    :edit-render="{ name: 'input', autoselect: true, events: { change: redoresultchange } }"></vxe-table-column>
                  <vxe-table-column field="log_date" sortable title="复查时间" width="100"></vxe-table-column>
                  <vxe-table-column field="log_content" sortable title="备注"></vxe-table-column>
                  <vxe-table-column field="seq" sortable title="序号" width="60"></vxe-table-column>
                </vxe-table>
                <template>
                  <div style="overflow: hidden;position: absolute;left:20px;bottom: 30px;z-index: 1;width: 230px;">
                    <el-button @click="BeforeRechkDetailDelete(2)" class="el-button--310">删除明细结果</el-button>
                    <el-checkbox v-model="isallowsync" style="padding-left: 5px" true-label="1"
                      false-label="0">同步本次复查前结果</el-checkbox>
                  </div>
                </template>
              </div>
              <div v-else style="height: 69%; padding-top: 5px">
                <vxe-table :data="tableDataRechkDetail" :select-config="selectConfig" :keyboard-config="keyConfig"
                  @cell-dblclick="RechkDetailDblClick" height="100%" highlight-current-row highlight-hover-row
                  ref="xTableRechkDetail" resizable highlight-hover-column border show-header-overflow="tooltip"
                  show-overflow="tooltip" header-align="center" :loading="loadingRechkDetail" size="mini" stripe
                  width="800px">
                  <vxe-table-column :field="item.field" :title="item.title" :width="item.width" :key="item.field"
                    v-for="item in tableColumnRechkDetail"></vxe-table-column>
                </vxe-table>
                <template>
                  <div style="overflow: hidden;position: absolute;left:20px;bottom: 30px;z-index: 1;width: 100px;">
                    <el-button @click="BeforeRechkDetailDelete(2)" class="el-button--310">删除明细结果</el-button>
                  </div>
                </template>
              </div>
            </el-tab-pane>

            <el-tab-pane v-if="Tablist.split(',').indexOf('7') > -1" name="7" label="仪器诊断" key="7">
              <el-input type="textarea" style="width: 580px; margin-left: 5px" height="100%" v-model="tabinstrresult"
                :autosize="{ minRows: 40, maxRows: 100 }" disabled></el-input>
            </el-tab-pane>

            <el-tab-pane v-if="Tablist.split(',').indexOf('8') > -1" name="8" label="通讯" key="8">
              <div style="height: 100%">
                <vxe-table :data="tableDataCommunite" :select-config="selectConfig" :keyboard-config="keyConfig"
                  height="100%" highlight-current-row highlight-hover-row ref="xTableCommunite" resizable
                  highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip"
                  header-align="center" :loading="loadingCommunite" size="mini" stripe width="800px">
                  <vxe-table-column :field="item.field" :title="item.title" :width="item.width" :key="item.field"
                    v-for="item in tableColumnCommunite"></vxe-table-column>
                </vxe-table>
              </div>
              <div></div>
            </el-tab-pane>

            <el-tab-pane v-if="Tablist.split(',').indexOf('9') > -1" name="9" label="扩展信息" key="9"> </el-tab-pane>

            <el-tab-pane v-if="Tablist.split(',').indexOf('10') > -1" name="10" label="原始结果" key="10">
              <div style="height: 100%">
                <vxe-table :data="tableDataInstr" :select-config="selectConfig" :keyboard-config="keyConfig" height="100%"
                  highlight-current-row highlight-hover-row ref="xTableInstr" resizable highlight-hover-column border
                  show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" :loading="loadingCommunite"
                  size="mini" stripe width="800px">
                  <vxe-table-column field="interno" title="通道号" width="60px"></vxe-table-column>
                  <vxe-table-column field="itemcode_en" title="英文缩写" width="60px"></vxe-table-column>
                  <vxe-table-column field="result_str" title="检验结果" width="60px" align="right"
                    header-align="center"></vxe-table-column>
                  <vxe-table-column field="result1" title="结果1" width="60px" align="right"
                    header-align="center"></vxe-table-column>
                  <vxe-table-column field="result2" title="结果2" width="60px" align="right"
                    header-align="center"></vxe-table-column>
                  <vxe-table-column field="result3" title="结果3" width="60px" align="right"
                    header-align="center"></vxe-table-column>
                  <vxe-table-column field="rpt_itemname" title="对应报告项目" width="120px"></vxe-table-column>
                  <vxe-table-column field="instrname" title="仪器" width="100px" align="center"></vxe-table-column>
                  <vxe-table-column field="result_dt" title="结果时间" width="130px" align="center"></vxe-table-column>
                  <vxe-table-column field="recieve_dt" title="接收时间" width="130px" align="center"></vxe-table-column>
                  <vxe-table-column field="instrsampleno" title="原始标本号" width="100px" align="center"></vxe-table-column>
                  <vxe-table-column field="testtypename" title="测试类别" width="60px" align="center"></vxe-table-column>
                  <vxe-table-column field="result_flag" title="标志" width="40px" align="center"></vxe-table-column>
                  <vxe-table-column field="inlibname" title="入库标志" width="100px" align="center"></vxe-table-column>
                </vxe-table>
              </div>
            </el-tab-pane>

            <!-- <el-tab-pane v-if="Tablist.split(',').indexOf('11')>-1" name="11" label="样本">
                      </el-tab-pane> -->

            <el-tab-pane v-if="Tablist.split(',').indexOf('12') > -1" name="12" label="样本图像" key="12">
              <span style="color: blue">当前标本号{{ specno }}:【{{ selectdate }}】</span>
              <div v-for="(image, index) in sampleImageList" :key="index" v-show="!ConfigDetail.set_imgori"
                class="basecolor">
                <el-image style="width: 200px; height: 120px; z-index: auto" :src="image" fit="contain"
                  :preview-src-list="[image]"></el-image>
              </div>
              <div style="width: 100%; height: calc(100% - 110px)" v-show="ConfigDetail.set_imgori" class="basecolor">
                <el-image :src="selectsampleimage" :preview-src-list="[selectsampleimage]" title="点击查看清晰图片"
                  style="width: 100%; height: 100%; z-index: auto" fit="contain">
                  <div slot="error" style="height: 100%; text-align: center"></div>
                </el-image>
              </div>
              <div style="width: 100%; height: 95px; border: 1px solid #ccc; margin-top: 5px; overflow-x: auto"
                v-show="ConfigDetail.set_imgori">
                <table style="height: 85px">
                  <tr>
                    <td v-for="(image, index) in sampleImageList" :key="index" style="text-align: left">
                      <div @click="sampleimagechange(image, index)"
                        :style="{ border: SampleImageIndex[index] ? '1px solid red' : '1px solid white', width: '80px' }">
                        <el-image style="height: 80px; z-index: auto" :src="image"></el-image>
                      </div>
                    </td>
                  </tr>
                </table>
              </div>
            </el-tab-pane>

            <el-tab-pane v-if="Tablist.split(',').indexOf('15') > -1" name="15" label="混样明细" key="15">
              <div style="height: 100%">
                <vxe-table :data="tableDataMixTab" :loading="loadingMixTab" :select-config="selectConfig"
                  :keyboard-config="keyConfig" :cell-class-name="cellMixTabClassName" height="100%" highlight-current-row
                  ref="xTableMixTab" resizable highlight-hover-column border show-header-overflow="tooltip"
                  show-overflow="tooltip" header-align="center" size="mini" width="800px">
                  <vxe-table-column field="seq" title="序号" width="40px" align="center"></vxe-table-column>
                  <vxe-table-column field="req_statname" title="状态" width="60px" sortable
                    align="center"></vxe-table-column>
                  <vxe-table-column field="barcode" title="样本条码号" width="130px" sortable></vxe-table-column>
                  <vxe-table-column field="pat_no" title="病人号" width="130px" sortable></vxe-table-column>
                  <vxe-table-column field="pat_name" title="病人姓名" width="80px" sortable align="center"></vxe-table-column>
                  <vxe-table-column field="pat_idcardno" title="身份证号护照号" width="180px" sortable></vxe-table-column>
                  <vxe-table-column field="pat_phone" title="联系电话" width="120px" sortable></vxe-table-column>
                  <vxe-table-column field="sample_items" title="项目描述" width="180px" sortable></vxe-table-column>
                </vxe-table>
              </div>
            </el-tab-pane>

            <el-tab-pane v-if="Tablist.split(',').indexOf('14') > -1" name="14" label="日志" key="14">
              <div style="height: 50%">
                <rm_Common_Reportlog height="100%" :key="logid" :reportid="ReportLogid" :isShowBtn="false" :showreqlog="1"
                  @loaddetail="LoadRptLogDetail"></rm_Common_Reportlog>
              </div>
              <div style="height: 50%">
                <vxe-table :data.sync="tableDataRptLogDetail" ref="xTableRptLog" :loading="RptLogDetailloading"
                  :sort-config="{ trigger: 'cell' }" show-overflow border size="mini" height="100%" show-header-overflow
                  highlight-current-row highlight-hover-row resizable stripe>
                  <!-- <vxe-table-column field="rpt_logid" title="日志明细ID" width="100" sortable header-align="center"></vxe-table-column> -->
                  <vxe-table-column field="objecttype" title="修改类型" width="80" sortable
                    header-align="center"></vxe-table-column>
                  <vxe-table-column field="columnname" title="修改对象" width="160" sortable
                    header-align="center"></vxe-table-column>
                  <vxe-table-column field="oldvalue" title="修改/复查前取值" width="160" sortable
                    header-align="center"></vxe-table-column>
                  <vxe-table-column field="newvalue" title="修改/复查后取值" width="160" sortable
                    header-align="center"></vxe-table-column>
                </vxe-table>
              </div>
            </el-tab-pane>
            <el-tab-pane v-if="Tablist.split(',').indexOf('16') > -1" name="16" label="危急值项目" key="16">
              <div style="width: 100px; text-align: center; vertical-align: top; position: absolute;height:100%">
                <vxe-table :data="alteritemData" :loading="Alteritemloading" :select-config="selectConfig"
                  :keyboard-config="keyConfig" @current-change="alteritemChange" height="100%" highlight-current-row
                  ref="xTableAlterTab" resizable highlight-hover-column border :show-header="false"
                  show-overflow="tooltip" header-align="center" size="mini" width="100px">
                  <vxe-table-column prop="rpt_itemname" label="危急值项目" align="center" sortable></vxe-table-column>
                </vxe-table>
              </div>
              <div
                style="width: calc(100% - 100px); left: 100px; position: absolute; height: 100%; border: 1px solid #c1b9b9">
                <template>
                  <div class="alert-block">
                    <el-timeline>
                      <el-timeline-item v-for="(activity, index) in activities" :key="index" :timestamp="activity.time"
                        placement="top">
                        <el-card>
                          <h4>{{ activity.content }}</h4>
                          <p>{{ activity.info }}</p>
                        </el-card>
                      </el-timeline-item>
                    </el-timeline>
                  </div>
                </template>
              </div>
            </el-tab-pane>
          </el-tabs>
        </div>
      </template>
    </rm-layout-right>

    <div v-show="ColelseDataShow"
      style="position: absolute; left: 230px; top: 36px; background-color: white; border-right: 3px solid #ccc">
      <table v-for="(cols, index) in ColTotalData" :key="index"
        style="float: left; margin-right: 0px; border-spacing: 3px" class="tableleft">
        <tr v-for="item in cols" :key="item.col_code" v-show="item.visibled">
          <td style="width: 50px">{{ item.col_label }}</td>
          <td
            v-if="PatientInfo['rechkflag'] == '9' || (Options.onlymodifymyreport == '1' && $tool.getSession(this.$tool.loginuserno) != PatientInfo['report_user'])">
            <div style="width: 160px" v-if="item.col_code === 'pat_sex'" v-show="item.visibled">
              <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                v-model="PatientInfo[item.col_code + 'name']" style="width: 60%" :disabled="!item.enabled"
                @keyup.enter.native="EnterEvent(item.col_code)" :ref="item.col_code" readonly size="mini"></el-input>
              <el-checkbox v-model="PatientInfo['emer_flag']" style="padding-left: 5px" true-label="1" false-label="0"
                ref="emer_flag" disabled class="emerflagredcolor">加急</el-checkbox>
            </div>
            <div style="width: 160px" v-else-if="item.col_code === 'markreason'" v-show="item.visibled">
              <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                v-model="PatientInfo[item.col_code]"
                :style="{ width: Options.checkmustpassmarkreason == '1' ? '80%' : '100%' }" :disabled="!item.enabled"
                @keyup.enter.native="EnterEvent(item.col_code)" :ref="item.col_code" readonly size="mini"></el-input>
              <el-checkbox v-if="Options.checkmustpassmarkreason == '1'" v-model="PatientInfo['markreasonpass']"
                style="padding-left: 5px" true-label="2" false-label="1" ref="markreasonpass"
                :disabled="markreasonpasseditflag"></el-checkbox>
            </div>
            <div style="width: 100%" v-else-if="item.col_code === 'pat_no'" v-show="item.visibled">
              <table style="border-spacing: 0px">
                <tr>
                  <td style="text-align: left; width: 160px">
                    <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                      v-model="PatientInfo[item.col_code]" style="width: 100%" :disabled="!item.enabled"
                      @keyup.enter.native="EnterEvent(item.col_code)" :ref="item.col_code" readonly
                      size="mini"></el-input>
                  </td>
                  <td>
                    <div class="el-button el-button--mini"
                      style="height: 20px; margin-left: 2px; font-size: 10px; padding: 5px 14px">读卡</div>
                  </td>
                </tr>
              </table>
            </div>
            <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
              v-model="PatientInfo[item.col_code]" v-else-if="item.col_code === 'lab_advice'"
              @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled" size="mini" :readonly="true"
              :ref="item.col_code"></el-input>
            <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
              v-model="PatientInfo[item.col_code + 'name']" v-else-if="item.valuetype == '5'"
              @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled" :disabled="!item.enabled" readonly
              :ref="item.col_code" size="mini"></el-input>
            <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none" v-else
              v-model="PatientInfo[item.col_code]" v-show="item.visibled" readonly size="mini"
              :ref="item.col_code"></el-input>
          </td>
          <td v-else width="160px">
            <div style="width: 160px" v-if="item.col_code === 'pat_sex'" v-show="item.visibled">
              <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                v-model="PatientInfo[item.col_code + 'name']" style="width: 60%" :disabled="!item.enabled"
                @keyup.enter.native="EnterEvent(item.col_code)" @dblclick.native="inputdblEvent(item.col_code)"
                @keyup.up.native="InputMove(0, item.col_code)" @keyup.down.native="InputMove(1, item.col_code)"
                @change="popinputchange($event, item)" @focus="InputFocus(item.col_code)" :ref="item.col_code"
                size="mini"></el-input>
              <el-checkbox v-model="PatientInfo['emer_flag']" style="padding-left: 5px" true-label="1" false-label="0"
                ref="emer_flag" class="emerflagredcolor">加急</el-checkbox>
            </div>
            <div style="width: 160px" v-else-if="item.col_code === 'markreason'" v-show="item.visibled">
              <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                v-model="PatientInfo[item.col_code]"
                :style="{ width: Options.checkmustpassmarkreason == '1' ? '80%' : '100%' }" :disabled="!item.enabled"
                @keyup.enter.native="EnterEvent(item.col_code)" @dblclick.native="inputdblEvent(item.col_code)"
                @keyup.up.native="InputMove(0, item.col_code)" @keyup.down.native="InputMove(1, item.col_code)"
                @change="popinputchange($event, item)" @focus="InputFocus(item.col_code)" :ref="item.col_code"
                size="mini"></el-input>
              <el-checkbox v-if="Options.checkmustpassmarkreason == '1'" v-model="PatientInfo['markreasonpass']"
                style="padding-left: 5px" true-label="2" false-label="1" ref="markreasonpass"
                :disabled="markreasonpasseditflag"></el-checkbox>
            </div>
            <div style="width: 100%" v-else-if="item.col_code === 'pat_no'" v-show="item.visibled">
              <table style="border-spacing: 0px">
                <tr>
                  <td style="text-align: left; width: 160px">
                    <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
                      v-model="PatientInfo[item.col_code]" style="width: 100%" :disabled="!item.enabled"
                      @keyup.enter.native="EnterEvent(item.col_code)" @dblclick.native="inputdblEvent(item.col_code)"
                      @keyup.up.native="InputMove(0, item.col_code)" @keyup.down.native="InputMove(1, item.col_code)"
                      @change="inputChangeEvent($event, item.col_code)" @focus="InputFocus(item.col_code)"
                      :ref="item.col_code" size="mini"></el-input>
                  </td>
                  <td>
                    <div @click="ReadCard()" class="el-button el-button--mini"
                      style="height: 20px; margin-left: 2px; font-size: 10px; padding: 5px 14px">读卡</div>
                  </td>
                </tr>
              </table>
            </div>
            <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
              v-model="PatientInfo[item.col_code]"
              v-else-if="item.col_code === 'lab_advice' || item.col_code.indexOf('reserve') > -1 || item.col_code.indexOf('txtinfo') > -1"
              @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled"
              @keyup.space.native="SpaceEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)"
              @keyup.down.native="InputMove(1, item.col_code)" @dblclick.native="inputdblEvent(item.col_code)"
              @change="popinputchange($event, item)" :readonly="item.noedit" @focus="InputFocus(item.col_code)"
              size="mini" :ref="item.col_code"></el-input>
            <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
              v-model="PatientInfo[item.col_code]" v-else-if="item.col_code === 'pat_agestr'"
              @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled" :disabled="!item.enabled"
              @keyup.space.native="SpaceEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)"
              @keyup.down.native="InputMove(1, item.col_code)" @dblclick.native="inputdblEvent(item.col_code)"
              @change="popinputchange($event, item)" :readonly="item.noedit" @focus="InputFocus(item.col_code)"
              size="mini" :ref="item.col_code"></el-input>
            <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
              v-model="PatientInfo[item.col_code + 'name']" v-else-if="item.valuetype == '5'"
              @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled" :disabled="!item.enabled"
              @keyup.space.native="SpaceEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)"
              @keyup.down.native="InputMove(1, item.col_code)" @dblclick.native="inputdblEvent(item.col_code)"
              @change="popinputchange($event, item)" @focus="InputFocus(item.col_code)" :ref="item.col_code"
              :readonly="item.col_code === 'report_user' || item.col_code === 'rechk_user' || item.noedit"
              size="mini"></el-input>
            <el-input :type="item.rowheight > 1 ? 'textarea' : 'text'" :rows="item.rowheight" resize="none"
              v-model="PatientInfo[item.col_code]" v-else-if="item.valuetype == '2'"
              @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled" :disabled="!item.enabled"
              @change="inputChangeEvent($event, item.col_code)" @keyup.up.native="InputMove(0, item.col_code)"
              @keyup.down.native="InputMove(1, item.col_code)" @focus="InputFocus(item.col_code)" size="mini"
              :ref="item.col_code"></el-input>
            <!-- <el-date-picker v-model="PatientInfo[item.col_code]" v-else-if="item.col_code === 'report_dt'" :inputable="true" v-show="item.visibled" type="datetime" :picker-options="expireTimeOption" value-format="yyyy-MM-dd HH:mm:ss" @keyup.enter.native="EnterEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)" @keyup.down.native="InputMove(1, item.col_code)" :disabled="!item.enabled" @focus="InputFocus(item.col_code)" @change="datechangelist($event, item.col_code)" size="mini" style="width: 100%" :ref="item.col_code"></el-date-picker>  -->
            <el-date-picker v-model="PatientInfo[item.col_code]" v-else-if="item.valuetype === '7'" :inputable="true"
              v-show="item.visibled" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
              @keyup.enter.native="EnterEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)"
              @keyup.down.native="InputMove(1, item.col_code)" :disabled="!item.enabled"
              @focus="InputFocus(item.col_code)" @change="datechangelist($event, item.col_code)" size="mini"
              style="width: 100%" :ref="item.col_code"></el-date-picker>
          </td>
        </tr>
      </table>
      <div>
        <el-button @click="ColelseDataShow = false">关闭</el-button>
      </div>
    </div>

    <rmLabReportConfig ref="rmLabReportConfig" :rptunitid="rptunitid" :tableDataColumn="tableDataColumn"
      :ConfigDetail="ConfigDetail" @configDefChange="configDefChange" @close="ConfigClose"></rmLabReportConfig>

    <!--报告全部信息弹框-->
    <!-- <el-dialog v-el-drag-dialog :close-on-click-modal="false" title="标本信息" :visible.sync="DetailVisible" width="1000px" style="padding: 5px 5px 5px 5px" top="6vh">
          <div style="float: left">
              <table v-for="(cols, index) in ColTotalData" :key="index" style="float: left; width: 24%">
                  <tr v-for="item in cols" :key="item.col_code" v-show="item.visibled">
                      <td style="width: 60px">{{ item.col_label }}</td>
                      <td>
                          <div v-if="item.col_code === 'pat_sex'" v-show="item.visibled">
                              <el-input v-model="PatientInfo[item.col_code + 'name']" style="width: 60%" :disabled="!item.enabled" @keyup.enter.native="EnterEvent(item.col_code)" @dblclick.native="inputdblEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)" @keyup.down.native="InputMove(1, item.col_code)" @change="popinputchange($event, item)" @focus="InputFocus(item.col_code)" :ref="item.col_code" readonly="true" size="mini"></el-input>
                              <el-checkbox v-model="PatientInfo['emer_flag']" style="padding-left: 5px" true-label="1" false-label="0" ref="emer_flag" class="emerflagredcolor">加急</el-checkbox>
                          </div>
                          <div v-else-if="item.col_code === 'markreason'" v-show="item.visibled">
                              <el-input v-model="PatientInfo[item.col_code]" :style="{width:Options.checkmustpassmarkreason== '1' ? '80%' :'100%'}" :disabled="!item.enabled" @keyup.enter.native="EnterEvent(item.col_code)" @dblclick.native="inputdblEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)" @keyup.down.native="InputMove(1, item.col_code)" @change="popinputchange($event, item)" @focus="InputFocus(item.col_code)" :ref="item.col_code" readonly="true" size="mini"></el-input>
                              <el-checkbox v-if="Options.checkmustpassmarkreason== '1'" v-model="PatientInfo['markreasonpass']" style="padding-left: 5px" true-label="2" false-label="1" ref="markreasonpass" :disabled="markreasonpasseditflag"></el-checkbox>
                          </div>
                          <el-input v-model="PatientInfo[item.col_code]" v-else-if="item.col_code === 'lab_advice'" @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled" @keyup.space.native="SpaceEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)" @keyup.down.native="InputMove(1, item.col_code)" @dblclick.native="inputdblEvent(item.col_code)" @change="popinputchange($event, item)" @focus="InputFocus(item.col_code)" size="mini" readonly="true" :ref="item.col_code"></el-input>
                          <el-input v-model="PatientInfo[item.col_code]" v-else-if="item.col_code === 'pat_agestr'" @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled" @keyup.space.native="SpaceEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)" @keyup.down.native="InputMove(1, item.col_code)" @dblclick.native="inputdblEvent(item.col_code)" @change="popinputchange($event, item)" @focus="InputFocus(item.col_code)" size="mini" readonly="true" :ref="item.col_code"></el-input>
                          <el-input v-model="PatientInfo[item.col_code + 'name']" v-else-if="item.valuetype == '5'" @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled" @keyup.space.native="SpaceEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)" @keyup.down.native="InputMove(1, item.col_code)" @dblclick.native="inputdblEvent(item.col_code)" @change="popinputchange($event, item)" @focus="InputFocus(item.col_code)" :ref="item.col_code" readonly="true" size="mini"></el-input>
                          <el-input v-model="PatientInfo[item.col_code]" v-else-if="item.valuetype == '2'" @keyup.enter.native="EnterEvent(item.col_code)" v-show="item.visibled" readonly="true" @change="inputChangeEvent($event, item.col_code)" @keyup.up.native="InputMove(0, item.col_code)" @keyup.down.native="InputMove(1, item.col_code)" @focus="InputFocus(item.col_code)" size="mini" :ref="item.col_code"></el-input>
                          <el-date-picker v-model="PatientInfo[item.col_code]" v-else-if="item.valuetype === '7'" v-show="item.visibled" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" @change="inputChangeEvent($event, item.col_code)" @keyup.enter.native="EnterEvent(item.col_code)" @keyup.up.native="InputMove(0, item.col_code)" @keyup.down.native="InputMove(1, item.col_code)" readonly="true" @focus="InputFocus(item.col_code)" align="right" size="mini" :ref="item.col_code"></el-date-picker>
                      </td>
                  </tr>
              </table>
          </div>
          <div style="margin-left: 780px">
              <el-button @click="DetailVisible = false">关闭</el-button>
          </div>
      </el-dialog> -->

    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="poptitle"
      :visible.sync="dialogTableVisible" @close="popcommonclose" v-if="dialogTableVisible" ref="popcommondialog">
      <rm-pop-common @cancel="(dialogTableVisible = false), popcommonclose()" :datatype="popdatatype"
        :rptunitid="rptunitid" @change="popchange" ref="popcommon"></rm-pop-common>
      <!--LIS3_xxx-->
    </el-dialog>
    <!--病人年龄框-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="病人年龄"
      :visible.sync="dialogAgeVisible" v-if="dialogAgeVisible" @close="$refs.pat_agestr[0].select()">
      <table style="border: 1px solid #fff">
        <tr>
          <td>
            <el-input v-model="inputfatherage" @input="ageinput($event, 1)"></el-input>
          </td>
          <td>
            <el-radio-group v-model="radiofatherunit" @change="AgeRadioChange">
              <el-radio label="岁"></el-radio>
              <el-radio label="月"></el-radio>
              <el-radio label="日"></el-radio>
              <el-radio label="小时">小时</el-radio>
              <el-radio label="分钟">分钟</el-radio>
            </el-radio-group>
          </td>
        </tr>
        <tr>
          <td>
            <el-input v-model="inputsonage" @input="ageinput($event, 2)"></el-input>
          </td>
          <td>
            <el-radio-group v-model="radiosonunit" disabled>
              <el-radio label="月">月</el-radio>
              <el-radio label="日">日</el-radio>
              <el-radio label="小时">小时</el-radio>
              <el-radio label="分钟">分钟</el-radio>
            </el-radio-group>
          </td>
        </tr>
        <tr>
          <td colspan="2" style="text-align: left">返回年龄：{{ reagestrch }}</td>
        </tr>
        <tr>
          <td colspan="2" style="text-align: left">可在前台病人年龄框中输入：{{ reagestren }} 返回相同结果<br />y表示岁 m表示月 d表示日 h表示小时 f表示分钟
          </td>
        </tr>
      </table>
      <div style="text-align: right">
        <span class="dialog-footer" slot="footer">
          <el-button @click="AgeSubmit()">确 定</el-button>
          <el-button @click="dialogAgeVisible = false">取 消</el-button>
        </span>
      </div>
    </el-dialog>
    <!--医生更换登录框-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="用户登录"
      :visible.sync="dialogLoginVisible" v-if="dialogLoginVisible" @close="(specinuseflag = '1'), (userpwd = '')">
      <table style="border: 1px solid #eee; width: 100%">
        <tr>
          <td>用户代码</td>
          <td>
            <el-input v-model="usercode" disabled></el-input>
          </td>
        </tr>
        <tr>
          <td>登录者姓名</td>
          <td>
            <el-input v-model="username" disabled></el-input>
          </td>
        </tr>
        <tr>
          <td>密码</td>
          <td>
            <el-input placeholder="请输入密码" v-model="userpwd" show-password ref="loginpwd"></el-input>
          </td>
        </tr>
        <tr>
          <td width="80"></td>
          <td>
            <el-radio v-model="specinuseflag" label="1">仅修改当前样本</el-radio>
          </td>
        </tr>
        <tr>
          <td></td>
          <td>
            <el-radio v-model="specinuseflag" label="2">修改当前及接下来的标本</el-radio>
          </td>
        </tr>
        <tr>
          <td></td>
          <td>
            <el-radio v-model="specinuseflag" label="3">修改当前报告单元所有未审核的标本</el-radio>
          </td>
        </tr>
        <tr>
          <td></td>
          <td class="vxe-body--row">
            <el-radio v-model="specinuseflag" label="4" style="margin-right: 5px">修改标本号区间</el-radio>
            <el-input v-model="specrange" style="width: 100px"></el-input>
          </td>
        </tr>
      </table>
      <div style="text-align: right; margin-top: 2px">
        <span class="dialog-footer" slot="footer">
          <el-button @click="LoginChange()">登 录</el-button>
          <el-button @click="LoginCancel()">取消</el-button>
        </span>
      </div>
    </el-dialog>
    <!--his接口返回申请项目开窗-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="选择申请项目"
      :visible.sync="dialogRptItemVisible" v-if="dialogRptItemVisible">
      <table style="width: 70%">
        <tr>
          <td>
            <el-button @click="SavePopReq" ref="savepopreqbtn">确定</el-button>
          </td>
          <td>
            <el-button @click="dialogRptItemVisible = false">取消</el-button>
          </td>
          <td style="text-align: left">申请日期</td>
          <td>
            <el-select style="width: 100px; margin-left: 10px" v-model="HisReAppDate" @change="filterHisReq">
              <el-option label="3" value="3"></el-option>
              <el-option label="7" value="7"></el-option>
              <el-option label="30" value="30"></el-option>
              <el-option label="180" value="180"></el-option>
              <el-option label="365" value="365"></el-option>
              <el-option label="  " value="0"></el-option> </el-select>天内
          </td>
          <td style="text-align: left">
            <el-checkbox v-model="rpt_itemall" @change="HisChangeAll">全选</el-checkbox>
          </td>
          <td>
            <el-checkbox v-model="showallrptitem" @change="filterHisReq">显示所有项目</el-checkbox>
          </td>
        </tr>
      </table>
      <vxe-table :data.sync="tableDataHisReturn" :sort-config="{ trigger: 'cell' }" :select-config="selectConfig"
        :row-class-name="HisReturnClass" height="500px" highlight-current-row highlight-hover-row ref="xTableHisRe"
        resizable highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip"
        header-align="center" size="mini" width="600px">
        <vxe-table-column field="bselect" title="选择" width="50px" align="center">
          <template v-slot="{ row }">
            <el-checkbox label="" v-model="row.bselect"></el-checkbox>
          </template>
        </vxe-table-column>
        <vxe-table-column :field="item.field" :title="item.title" :width="item.width" v-for="item in tableColumnHisReturn"
          v-bind:key="item.field"></vxe-table-column>
      </vxe-table>
    </el-dialog>
    <!--核收开窗-->
    <rmLabReportCollect ref="rmLabReportCollect" @IsSelectPrint="IsSelectPrint"></rmLabReportCollect>
    <!--危急值上报弹窗-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="危急值上报"
      :visible.sync="dialogDangerVisible" v-if="dialogDangerVisible" ref="dangerdialog" width="900px"
      @close="DangerCancel">
      <rm-pop-danger :reportid="dangerreportid" :rptunitid="rptunitid" :redoflag="Options.alertcaninputredoresult"
        :checkuser="CurrentCheckUser" :reportuser="CurrentReportUser"
        @confirminfo="dialogBactchRechkVisible ? BatCheckDangerDeal($event, 1) : CheckDangerDeal($event, 1)"
        @abandoninfo="dialogBactchRechkVisible ? BatCheckDangerDeal($event, 2) : CheckDangerDeal($event, 2)"
        @cancel="DangerCancel" :AllFlag="DangerAllflag" :Options="Options"></rm-pop-danger>
    </el-dialog>

    <!--历史结果查看全部弹窗drawchart-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="相关结果查看"
      :visible.sync="dialogHistoryVisible" v-if="dialogHistoryVisible" width="750px">
      <div style="height: 50%">
        <vxe-table :data="tableDataHistoryDialog" @current-change="CurrentHistoryChange" :select-config="selectConfig"
          :keyboard-config="keyConfig" height="300px" highlight-current-row highlight-hover-row ref="xTableDialogHistory"
          resizable highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip"
          header-align="center" :loading="loadingHistoryDialog" size="mini" stripe width="auto">
          <vxe-table-column :field="item.field" :title="item.title" :width="item.width" :key="item.field"
            v-for="item in tableColumnHistoryDialog"></vxe-table-column>
        </vxe-table>
      </div>
      <div id="dialoghistoryChart"
        style="width: 100%; height: 300px; vertical-align: center; border: 1px solid #ccc; margin-top: 2px"></div>
    </el-dialog>

    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false"
      :visible.sync="dialogReportLogVisible" v-if="dialogReportLogVisible" title="检验报告操作日志" top="5vh" width="800px">
      <rm_Common_Reportlog :reportid="ReportLogid" @cancel="dialogReportLogVisible = false"></rm_Common_Reportlog>
    </el-dialog>
    <!--消息弹出框可回看式-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :visible.sync="dialogMsgVisible"
      :title="msgtitle" :destroy-on-close="true" top="5vh" width="600px" ref="msgdialog"
      @close="$refs.msgdialog.Cancel()">
      <el-carousel trigger="click" height="200px" :autoplay="false" :loop="false" arrow="always"
        @change="MsgCarouselChange">
        <el-carousel-item v-for="(item, index) in msglist" :key="index">
          <div style="width: 80%; margin-left: 50px">
            <div v-if="item.keycode" v-html="item.msg.title"></div>
            <div v-else v-html="item.content" style="height: 100px"></div>
            <div v-if="item.keycode" style="padding-top: 5px">
              <el-input v-model="inmsg" type="textarea" :rows="8"
                @dblclick.native="msgDblClick(item.msg.content, item.keycode)" placeholder="双击开窗选择解除审核原因"
                v-if="item.msg.content.indexOf('解除审核') > -1"></el-input>
              <el-input type="textarea" :rows="2" v-model="inmsg" v-else></el-input>
              <el-button @click="SaveInputMsg(item.keycode)">保存</el-button>
            </div>
          </div>
        </el-carousel-item>
      </el-carousel>
      <div style="text-align: right">
        <span style="margin-right: 5px">{{ NowMsgNo }}/{{ TotalMsgNo }} 翻页查看所有消息后才可确定</span>
        <el-button @click="$refs.msgdialog.Confirm()" :disabled="MsgAllOver || Submitdisabled">确 定</el-button>
        <el-button @click="$refs.msgdialog.Cancel()">取 消</el-button>
      </div>
    </el-dialog>
    <!--消息弹出框一览式-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :visible.sync="dialogMsgListVisible"
      title="消息一览" top="5vh" width="730px" ref="msglistdialog" @close="$refs.msglistdialog.Cancel()">
      <div style="height: 530px">
        <vxe-table :data="tableDataMsgDialog" :select-config="selectConfig" :keyboard-config="keyConfig"
          :row-class-name="ListMsgClassName" height="100%" highlight-current-row highlight-hover-row ref="xTableDialogMsg"
          resizable highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip"
          header-align="center" :loading="loadingMsgDialog" size="mini" stripe width="auto">
          <vxe-table-column type="index" title="NO." width="40" align="center"></vxe-table-column>
          <vxe-table-column field="kind" title="提示类型" width="100" sortable header-align="center"></vxe-table-column>
          <vxe-table-column field="title" title="提示标题" width="140" sortable header-align="center">
            <template v-slot="{ row }">
              <div v-if="row.keycode">
                <span>{{ row.msg.title }}</span>
              </div>
              <div v-else>{{ row.title }}</div>
            </template>
          </vxe-table-column>
          <vxe-table-column field="content" title="提示内容" :width="showInputColumn ? 200 : 435" sortable
            header-align="center">
            <template v-slot="{ row }">
              <div v-if="row.keycode">
                <span style="white-space:normal;">{{ row.msg.content }}</span>
              </div>
              <div v-else><span style="white-space:normal;">{{ row.content }}</span></div>
            </template>
          </vxe-table-column>
          <vxe-table-column v-if="showInputColumn" field="inputtxt" title="输入内容" width="235" sortable
            header-align="center">
            <template v-slot="{ row }">
              <div v-if="row.keycode">
                <el-input v-model="inmsg" type="textarea" style="width:200px;"
                  @dblclick.native="msgDblClick(row.msg.content, row.keycode)" placeholder="双击开窗选择解除审核原因"
                  v-if="row.msg.content.indexOf('解除审核') > -1"></el-input>
                <el-input v-model="inmsg" type="textarea" style="width:200px;" v-else></el-input>
                <el-button @click="SaveInputMsg(row.keycode)">保存</el-button>
              </div>
            </template>
          </vxe-table-column>
        </vxe-table>
      </div>
      <div style="text-align: right;margin-top:5px;">
        <el-button @click="$refs.msglistdialog.Confirm()" :disabled="Submitdisabled">确 定</el-button>
        <el-button v-if="dialogMsgListVisible" @click="$refs.msglistdialog.Cancel()" v-focus>取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :visible.sync="dialogAdviceVisible"
      title="报告单元文字描述结果选择" :destroy-on-close="true" top="5vh" width="700px">
      <div>
        <el-input type="textarea" :rows="6" v-model="advicetxt"></el-input>
      </div>
      <div>
        <table style="width: 100%; border-spacing: 0px; margin-top: 5px">
          <tr>
            <td>
              快速查找
              <el-input v-model="advicesearchtxt" @input="AdviceSearch" placeholder="请输入要查找的信息"
                style="width: calc(100% - 60px)"></el-input>
            </td>
          </tr>
          <tr>
            <td style="width: 450px">
              <vxe-table :data="tableDataAdvice" :select-config="selectConfig" :keyboard-config="keyConfig"
                :loading="loadingAdvice" @cell-click="AdviceClick" @cell-dblclick="AdvicedblClick" height="300px"
                highlight-current-row highlight-hover-row resizable highlight-hover-column border
                show-header-overflow="tooltip" show-overflow="tooltip" header-align="center" size="mini" stripe
                width="400px">
                <vxe-table-column field="txttitle" title="标题" width="100px"></vxe-table-column>
                <vxe-table-column field="txtinfo" title="文字描述" width="160px"></vxe-table-column>
                <vxe-table-column field="seq" title="序号" width="80px"></vxe-table-column>
                <vxe-table-column field="inputcode" title="输入码" width="80px"></vxe-table-column>
              </vxe-table>
            </td>
            <td>
              <div style="margin-left: 15px">
                <el-button style="display: block" @click="AdviceSubmit()">确 定</el-button>
                <el-button style="display: block; margin-left: 0px; margin-top: 5px"
                  @click="dialogAdviceVisible = false">取 消</el-button>
                <el-checkbox v-model="appendChangeRow" style="margin-top: 20px; display: block">追加时自动换行</el-checkbox>
                <div style="margin-top: 20px">
                  <span style="color: blue">说明:<br />单击为追加<br />双击为替换</span>
                </div>
              </div>
            </td>
          </tr>
        </table>
      </div>
    </el-dialog>

    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="单向合并" width="750px"
      :visible.sync="dialogmergeVisible">
      <table>
        <tr>
          <td>合并后标本号</td>
          <td>
            <el-input v-model="mergespecno" @keyup.enter.native="QueryBindmdldetail()"></el-input>
          </td>
          <td>
            <el-select v-model="mergemethod" @change="QueryBindmdldetail()">
              <el-option label="按样本号识别" value="1"></el-option>
              <el-option label="按采样时间识别" value="2"></el-option>
              <el-option label="按分单类别识别" value="3"></el-option>
              <el-option label="按当前标本号依序添加" value="4"></el-option>
              <el-option label="从当前样本号往后识别" value="5"></el-option>
            </el-select>
          </td>
          <td>
            <el-button @click="MergeSubmit()">合并</el-button>
            <el-button @click="dialogmergeVisible = false">退出</el-button>
          </td>
        </tr>
        <tr>
          <td>
            <div style="width: 160px">
              <vxe-table :data="tableDatamergeLeft" @current-change="currentmergeChangeEvent" border fit height="400px"
                header-align="center" highlight-current-row highlight-hover-row highlight-hover-column resizable
                show-header-overflow="tooltip" show-overflow="tooltip" size="mini" ref="xtablemerge" width="100px" stripe>
                <vxe-table-column field="mdlname" title="模板名称" width="100px" sortable></vxe-table-column>
                <vxe-table-column field="rpt_itemname" title="合并前项目" width="120px" sortable></vxe-table-column>
                <vxe-table-column field="keepinold" title="保留" width="80px" sortable></vxe-table-column>
                <vxe-table-column field="seq" title="序号" width="80px" sortable></vxe-table-column>
              </vxe-table>
            </div>
          </td>
          <td colspan="3">
            <div>
              <vxe-table :data="tableDatamergeRight" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: false }"
                border fit height="400px" header-align="center" highlight-current-row highlight-hover-row
                highlight-hover-column resizable show-header-overflow="tooltip" show-overflow="tooltip" size="mini"
                ref="xtablemergeright" stripe>
                <vxe-table-column field="sampleno" title="合并前标本号" width="120px"
                  :edit-render="{ name: 'input', autoselect: true, events: { change: mergesamplechange } }"></vxe-table-column>
                <vxe-table-column field="rpt_itemname" title="合并后报告项目" width="160px"></vxe-table-column>
                <vxe-table-column field="result_str" title="检验结果" width="80px" sortable></vxe-table-column>
                <vxe-table-column field="pat_name" title="病人姓名" width="80px" sortable></vxe-table-column>
                <vxe-table-column field="first_dt" title="结果时间" width="80px" sortable></vxe-table-column>
              </vxe-table>
            </div>
          </td>
        </tr>
      </table>
    </el-dialog>
    <!--标本合并弹窗-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="标本合并(移动)" width="1200px"
      :visible.sync="dialogmergespecVisible" v-if="dialogmergespecVisible">
      <LIS322 :beforerptunitid="rptunitid" style="height: 600px"></LIS322>
    </el-dialog>
    <!--申请tab双击弹窗-->
    <!-- <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="修改申请项目" width="800px" :visible.sync="dialogreqVisible" v-if="dialogreqVisible">
          <rmLabReportReq :PatientInfo="PatientInfo" :specno="specno" :rptunitid="rptunitid" :Options="Options" @reqtorptitem="ReqChangeSubmit" @close="dialogreqVisible = false" ref="reqitemdialog"></rmLabReportReq>
          <div>
              <table>
                  <tr>
                      <td colspan="2">
                          <div style="width:760px">
                              <vxe-table :data="tableDataDialogreqSelect" @cell-dblclick="cellDBLClickEvent($event,'1')" border fit height="200px" header-align="center" highlight-current-row highlight-hover-row highlight-hover-column resizable show-header-overflow="tooltip" show-overflow="tooltip" size="mini" ref="xtablereqtop" width="auto" stripe>
                                  <vxe-table-column field="req_itemname" title="申请项目名称" width="160px" sortable></vxe-table-column>
                                  <vxe-table-column field="item_price" title="单价" width="60px" sortable></vxe-table-column>
                                  <vxe-table-column field="qty" title="数量" width="60px" sortable></vxe-table-column>
                                  <vxe-table-column field="req_itemcode" title="申请项目代码" width="100px" sortable></vxe-table-column>
                                  <vxe-table-column field="req_itemna" title="申请项目简称" width="160px" sortable></vxe-table-column>
                              </vxe-table>
                          </div>
                      </td>
                  </tr>
                  <tr>
                      <td>
                          <div style="width:600px">
                              <vxe-table :data="tableDataDialogreqAll" @cell-dblclick="cellDBLClickEvent($event,'2')" border fit height="200px" header-align="center" highlight-current-row highlight-hover-row highlight-hover-column resizable show-header-overflow="tooltip" show-overflow="tooltip" size="mini" ref="xtablereqbottom" width="auto" stripe>
                                  <vxe-table-column field="req_itemname" title="申请项目名称" width="160px" sortable></vxe-table-column>
                                  <vxe-table-column field="item_price" title="单价" width="60px" sortable></vxe-table-column>
                                  <vxe-table-column field="qty" title="数量" width="60px" sortable></vxe-table-column>
                                  <vxe-table-column field="req_itemcode" title="申请项目代码" width="100px" sortable></vxe-table-column>
                                  <vxe-table-column field="req_itemna" title="申请项目简称" width="160px" sortable></vxe-table-column>
                              </vxe-table>
                          </div>
                      </td>
                      <td style="text-align:center">
                          <div>
                              <table style="width:100%">
                                  <tr>
                                      <td style="text-align:center">当前上机标本号
                                      </td>
                                  </tr>
                                  <tr>
                                      <td style="text-align:center">{{PatientInfo.reportid}}
                                      </td>
                                  </tr>
                                  <tr>
                                      <td>&nbsp; </td>
                                  </tr>
                                  <tr>
                                      <td style="text-align:center">
                                          <el-button @click="ReqChangeSubmit">确 定</el-button>
                                      </td>
                                  </tr>
                                  <tr>
                                      <td>&nbsp; </td>
                                  </tr>
                                  <tr>
                                      <td style="text-align:center">
                                          <el-button @click="dialogreqVisible = false">取 消</el-button>
                                      </td>
                                  </tr>
                              </table>
                          </div>
                      </td>
                  </tr>
              </table>
          </div>
      </el-dialog> -->
    <!--复查结果输入弹窗-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="复查结果输入" width="1000px"
      :visible.sync="dialogRechkDetailVisible">
      <table>
        <tr>
          <td>
            <div style="width: 800px">
              <vxe-table :data="tableReChkDetailDialog"
                :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true, showIcon: false }"
                :mouse-config="{ selected: true }" :select-config="selectConfig" border fit height="400px"
                header-align="center" highlight-current-row highlight-hover-row highlight-hover-column resizable
                show-header-overflow="tooltip" show-overflow="tooltip" size="mini" ref="xtableReChkDetaildialog"
                @cell-dblclick="rechkDblEvent" @edit-actived="rechkResultActive" @edit-closed="rechkResultClose" stripe>
                <vxe-table-column field="rpt_itemname" title="检验项目" width="160px"></vxe-table-column>
                <vxe-table-column field="result_str" title="检验结果" width="120px" sortable></vxe-table-column>
                <vxe-table-column field="redo_result" title="复查结果" width="120px" sortable
                  :edit-render="{ name: 'input', autoselect: true }">
                  <template v-slot:edit="{ row, rowIndex }">
                    <el-input v-model="row.redo_result" style="width: 100%;18px" ref="redoinput"
                      @keyup.enter.native="rechkAddRow(row, rowIndex)"
                      @keyup.down.native="rechkResultMove(row, 1, rowIndex, 'redo_result')"
                      @keyup.up.native="rechkResultMove(row, 0, rowIndex, 'redo_result')" @dblclick.native="ResultDblClick">
                      <i :class="iconclass" slot="suffix" @click="rechkhandleIconClick"
                        v-show="tableDataResultAll.length > 0 && Options.showrptitemvalbyfocus > 0"></i>
                    </el-input>
                    <div ref="selectDialog" class="reqitem-dialog" v-show="rechktextvalueshow"
                      style="width:100%;min-width: 240px">
                      <div class="reqitem-select">
                        <vxe-table :data.sync="tableDataResultAll" max-height="250px" stripe resizable
                          header-align="center" show-header-overflow highlight-hover-row :keyboard-config="keyConfig"
                          show-overflow="ellipsis" size="mini" :select-config="{ reserve: true }"
                          :sort-config="{ trigger: 'cell' }" @cell-click="ResultTextClick($event, row)"
                          status-msg-group="none" class="ResultTxtTable">
                          <vxe-table-column field="textvalue" title="文字结果" width="160px" align="left"
                            header-align="center" show-overflow-tooltip>
                            <template v-slot="{ row }">
                              <!-- <div :style="ResultClass(row)">

                                                          </div> -->
                              <span>{{ row.textvalue }}</span>
                            </template>
                          </vxe-table-column>
                          <vxe-table-column field="result_flag" title="结果标志" width="80px" align="center"
                            show-overflow-tooltip>
                            <template v-slot="{ row }">
                              <span>{{ ReusltflagName(row.result_flag) }}</span>
                            </template>
                          </vxe-table-column>
                          <vxe-table-column field="redoflag" title="复查标志" width="60px" align="center"
                            show-overflow-tooltip></vxe-table-column>
                          <vxe-table-column field="inputcode" title="输入码" width="80px" align="center"
                            show-overflow-tooltip></vxe-table-column>
                          <vxe-table-column field="seq" title="序号" width="40px" align="center"
                            show-overflow-tooltip></vxe-table-column>
                          <vxe-table-column field="containtext" title="录入码" width="100px" align="center"
                            show-overflow-tooltip></vxe-table-column>
                        </vxe-table>
                      </div>
                    </div>
                  </template>
                </vxe-table-column>
                <vxe-table-column field="redo_reason" title="复查原因" width="150px" sortable
                  :edit-render="{ name: 'input' }">
                  <template v-slot:edit="{ row }">
                    <el-select v-if="hasreasonoptionflag" v-model="row.redo_reason" filterable clearable
                      @keyup.enter.native="SelectInputChange($event, row)">
                      <el-option v-for="(item, index) in redoreasonoptions" :key="index" :value="item.label"
                        :label="item.label"></el-option>
                    </el-select>
                    <el-input v-else v-model="row.redo_reason"></el-input>
                  </template>
                </vxe-table-column>
                <vxe-table-column field="rpt_itemcode" title="检验项目代码" width="120px" sortable></vxe-table-column>
                <vxe-table-column title="加载结果" width="60px">
                  <template v-slot="{ row }">
                    <el-button @click="CopyCurResult(row)">加载</el-button>
                  </template>
                </vxe-table-column>
              </vxe-table>
            </div>
          </td>
          <td>
            <div style="height: 100px;padding-left:30px;">
              <el-button @click="CopybeforeToNow">加载全部结果</el-button>
            </div>
            <table style="height: 150px">
              <tr>
                <td style="text-align: center">
                  <div>
                    <el-button @click="RechkDetailSubmit">确 定</el-button>
                  </div>
                </td>
              </tr>
              <tr>
                <td style="text-align: center">
                  <div>
                    <el-button @click="dialogRechkDetailVisible = false">取 消</el-button>
                  </div>
                </td>
              </tr>
              <tr>
                <td style="text-align: center">
                  <el-checkbox v-model="ReChkDetailOverride" true-label="0" false-label="1">不覆盖当前结果</el-checkbox>
                </td>
              </tr>
            </table>
            <div style="height: 100px"></div>
          </td>
        </tr>
      </table>
    </el-dialog>

    <!--标记需复查弹窗-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="标记结果需复查"
      :visible.sync="dialogNeedRechkVisible" v-if="dialogNeedRechkVisible"
      :width="Options.redoflagaddoutredo == '1' ? '1045px' : '965px'">
      <table>
        <tr>
          <td>
            <div>
              <vxe-table :data="tableDataRedo"
                :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true, showIcon: false }" border height="300px"
                highlight-current-row highlight-hover-row resizable size="mini" stripe style="margin-top: 10px"
                header-align="center" ref="xTableRedo">
                <vxe-table-column field="rpt_itemname" title="检验项目" width="200px"></vxe-table-column>
                <vxe-table-column field="result_str" title="检验结果" width="80px"></vxe-table-column>
                <vxe-table-column field="redo_flag" title="复查标志"
                  :width="Options.redoflagaddoutredo == '1' ? '380px' : '310px'">
                  <template v-slot:header>
                    <div style="margin-left: 10px; margin-right: 10px; display: inline">复查标志</div>
                    <el-button @click="SetRedoflag('0')">重新计算</el-button>
                    <el-button @click="SetRedoflag('M')">需复查</el-button>
                    <el-button @click="SetRedoflag('2')">已复查</el-button>
                    <el-button @click="SetRedoflag('N')">无需复查</el-button>
                    <el-button v-if="Options.redoflagaddoutredo == '1'" @click="SetRedoflag('S')">外送复查</el-button>
                  </template>
                  <template v-slot="{ row }">
                    <el-radio-group v-model="row.redo_flag" :style="{ background: RedoClass(row.redo_flag) }"
                      @change="RedoflagChange($event, row)">
                      <el-radio label="0">重新计算</el-radio>
                      <el-radio label="M">需复查</el-radio>
                      <el-radio label="2">已复查</el-radio>
                      <el-radio label="N">无需复查</el-radio>
                      <el-radio v-if="Options.redoflagaddoutredo == '1'" label="S">外送复查</el-radio>
                    </el-radio-group>
                  </template>
                </vxe-table-column>
                <vxe-table-column field="redo_reason" title="复查原因" width="150px" sortable
                  :edit-render="{ name: 'input' }">
                  <template v-slot:edit="{ row }">
                    <el-select v-if="hasreasonoptionflag" v-model="row.redo_reason" filterable clearable
                      @keyup.enter.native="SelectInputChange($event, row)">
                      <el-option v-for="(item, index) in redoreasonoptions" :key="index" :value="item.label"
                        :label="item.label"></el-option>
                    </el-select>
                    <el-input v-else v-model="row.redo_reason"></el-input>
                  </template>
                </vxe-table-column>
                <vxe-table-column field="result2" title="稀释系数" width="80px"
                  :edit-render="{ name: 'input', autoselect: true }"></vxe-table-column>
                <vxe-table-column field="result_ref" title="参考值" width="100px"></vxe-table-column>
              </vxe-table>
            </div>
          </td>
        </tr>
      </table>
      <div style="text-align: right; width: 100%">
        <el-button @click="SaveNeedRechk()" style="margin-left: 10px">确定</el-button>
        <el-button @click="dialogNeedRechkVisible = false" style="margin-top: 10px; margin-left: 10px">取消</el-button>
      </div>
    </el-dialog>

    <!--报告删除弹窗-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="删除报告"
      :visible.sync="dialogDelVisible" v-if="dialogDelVisible" width="600px">
      <table style="width: 100%; border: 1px solid #ccc; border-spacing: 5px">
        <tr>
          <td>标本日期</td>
          <td>
            <el-input v-model="PatientInfo.sampledate" readonly></el-input>
          </td>
          <td>报告单元</td>
          <td>
            <el-input v-model="PatientInfo.rptunitid" readonly></el-input>
          </td>
        </tr>
        <tr>
          <td>样本号</td>
          <td>
            <el-input v-model="PatientInfo.sampleno" readonly></el-input>
          </td>
          <td>条码号</td>
          <td>
            <el-input v-model="PatientInfo.barcode" readonly></el-input>
          </td>
        </tr>
        <tr>
          <td>病历号</td>
          <td>
            <el-input v-model="PatientInfo.pat_no" readonly></el-input>
          </td>
          <td>病人姓名</td>
          <td>
            <el-input v-model="PatientInfo.pat_name" readonly></el-input>
          </td>
        </tr>
      </table>

      <div style="text-align: right; margin-top: 5px">
        <el-button @click="DelReport('1')">删除报告</el-button>
        <el-button @click="DelReport('2')">删除病人信息</el-button>
        <el-button @click="DelReport('3')">删除结果信息</el-button>
        <el-button @click="dialogDelVisible = false">取消</el-button>
      </div>
    </el-dialog>

    <!--合并当前病人结果弹窗-->
     <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="合并当前病人其他结果"
      :visible.sync="dialogpatmergerptVisible" v-if="dialogpatmergerptVisible" width="900px">             
      <rmMergePatLabRpt :pat_no="PatientInfo.pat_no" :rptunitid="rptunitid" :barcode="PatientInfo.barcode"
        original_reqno="" @close="dialogpatmergerptVisible = false"></rmMergePatLabRpt> </el-dialog>
    <!--当前危急值-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="今日危急值"
      :visible.sync="dialogtodaydangerVisible" v-if="dialogtodaydangerVisible" width="900px">
                  <rm-Rpt-AlertResultList :rptunitid="rptunitid"
        @cancel="dialogtodaydangerVisible = false"></rm-Rpt-AlertResultList> </el-dialog>
    <!--知识库展示-->
    <rm_Knowledge ref="rmknowledge"></rm_Knowledge>
    <!--批次审核弹窗-->
    <el-dialog v-el-drag-dialog :show-close="false" :append-to-body="true" :close-on-click-modal="false" title="批次审核报告"
      :visible.sync="dialogBactchRechkVisible" v-if="dialogBactchRechkVisible" width="600px">
      <table style="width: 100%">
        <tr>
          <td style="width: 60px; text-align: left">标本日期</td>
          <td>
            <el-date-picker v-model="BatRechkDate" :clearable="false" style="width: 200px"></el-date-picker>
          </td>
          <td style="text-align: left">
            <el-checkbox v-model="isautoprint" false-label="0" true-label="1">审核后自动打印</el-checkbox>
          </td>
          <td>
            <el-checkbox v-model="showRedo" false-label="0" true-label="1">不显示需复查报告</el-checkbox>
          </td>
        </tr>
        <tr>
          <td style="width: 60px; text-align: left">标本号</td>
          <td>
            <el-input v-model="BatRechkSampleno" style="width: 200px" @keyup.enter.native="QueryBatReport()"></el-input>
          </td>
          <td colspan="2" style="text-align: left">
            <p style="color: blue">标本号可以输入如：1,2,5-8等格式</p>
          </td>
        </tr>
        <tr>
          <td style="width: 60px; text-align: left">病人来源</td>
          <td>
            <el-select v-model="BatRechkPatType"
              @dblclick.native="popMultipleChk(BatRechkPatType, 'BatRechkPatType', pattypeOption, '病人类型选择')" filterable
              clearable style="width: 200px" @change="QueryBatReport()">
              <el-option v-for="(item, index) in pattypeOption" :value="item.data" :label="item.display"
                :key="index"></el-option>
            </el-select>
          </td>
          <td colspan="2" style="text-align: left">
            <p style="color: blue">病人来源可双击多选</p>
          </td>
        </tr>
        <tr>
          <td colspan="4">
            <div style="width: 100%">
              <vxe-table show-overflow ref="BatRechkTable" height="400px" :loading="BatRechkloading"
                :sort-config="{ trigger: 'cell' }" :select-config="{ checkAll: true }" :cell-class-name="RechkClass"
                :keyboard-config="keyConfig" :data.sync="BatRechkTableData" border size="mini" show-header-overflow
                highlight-current-row highlight-hover-row resizable stripe header-align="center">
                <vxe-table-column type="selection" width="45" align="center"></vxe-table-column>
                <vxe-table-column field="sampledate" title="标本日期" width="90" sortable
                  :formatter="['toDateString', 'yyyy-MM-dd']"></vxe-table-column>
                <vxe-table-column field="sampleno" title="标本编号" width="70" align="center"></vxe-table-column>
                <vxe-table-column field="pat_name" title="姓名" width="60" sortable></vxe-table-column>
                <vxe-table-column field="barcode" title="条码号" width="100" align="center"></vxe-table-column>
                <vxe-table-column field="pattypename" title="病人来源" width="80" align="center"></vxe-table-column>
                <vxe-table-column field="cp_msg" title="审核消息提示" width="120" align="center"></vxe-table-column>
              </vxe-table>
            </div>
          </td>
        </tr>
      </table>
      <div style="text-align: right">
        <el-button @click="QueryBatReport()">查 询</el-button>
        <el-button @click="BatchRechk()">审 核</el-button>
        <el-button @click="BatchCancel()">退 出</el-button>
      </div>
    </el-dialog>

    <rm-floatwindow v-rm-drag-window :visible="dialogimgfloatwindowVisible" :winStyle="floatwindowstyle1" title="图像"
      @close="FloatClose($event, '1')">
      <rm-layout-top splitcolor="#ccc" :splitwidth="3" :fixsize="300">
        <template v-slot:fix>
          <div style="height: 100%; overflow: auto">
            <div v-for="(image, index) in ImageList" :key="index">
              <el-image style="width: 200px;  height: 120px; z-index: auto" :src="image.url" fit="contain"
                :preview-src-list="[selectclearimage]" @click="ShowClearImage(image.name, image.seq)"></el-image>
              <div style="width: 200px; text-align: center">{{ image.name }}</div>
            </div>
          </div>
        </template>
        <div style="height: 100%; overflow: auto">
          <span style="font-size: 12px">
            {{ PatientInfo.instr_advice }}
          </span>
        </div>
      </rm-layout-top>
    </rm-floatwindow>

    <rm-floatwindow v-rm-drag-window :visible="dialogsampleimgfloatwindowVisible" :winStyle="floatwindowstyle2"
      title="样本图像" @close="FloatClose($event, '2')">
      <div style="font-size: 12px">检验目的: {{ PatientInfo.req_reason }}</div>
      <rm-layout-top splitcolor="#ccc" :splitwidth="3" :fixsize="300">
        <template v-slot:fix>
          <div style="height: 100%; overflow: auto">
            <div v-for="(image, index) in sampleImageList" :key="index">
              <el-image style="height: 250px; z-index: auto" :src="image" fit="contain"
                :preview-src-list="[image]"></el-image>
            </div>
          </div>
        </template>
        <div style="height: 100%; overflow: auto">
          <span style="font-size: 12px">
            {{ PatientInfo.instr_advice }}
          </span>
        </div>
      </rm-layout-top>
    </rm-floatwindow>
    <!--检验意见悬浮窗--->
    <rm-floatwindow v-rm-drag-window :visible="dialogAdvicefloatwindowVisible" :winStyle="floatwindowstyle3"
      :title="floatadvicetitle" @close="FloatClose($event, '3')">
      <div>
        <el-input type="textarea" :rows="6" v-model="txtadvice" @input="adviceinput"></el-input>
      </div>
      <div style="height: calc(100% - 130px)">
        <table style="width: 100%; border-spacing: 0px; margin-top: 5px; height: 100%">
          <tr>
            <td>
              快速查找
              <el-input v-model="advicesearchtxtFloat" @input="AdviceSearchFloat" placeholder="请输入要查找的信息"
                style="width: calc(100% - 60px)"></el-input>
            </td>
          </tr>
          <tr>
            <td style="height: 100%">
              <vxe-table :data="tableDataAdvice" :loading="loadingAdvice" @cell-click="AdviceFloatClick"
                @cell-dblclick="AdviceFloatdblClick" height="100%" highlight-current-row highlight-hover-row resizable
                highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center"
                size="mini" stripe width="auto">
                <vxe-table-column field="txttitle" title="标题" width="100px"></vxe-table-column>
                <vxe-table-column field="txtinfo" title="文字描述" width="160px"></vxe-table-column>
                <vxe-table-column field="seq" title="序号" width="80px"></vxe-table-column>
                <vxe-table-column field="inputcode" title="输入码" width="80px"></vxe-table-column>
              </vxe-table>
            </td>
            <td width="200">
              <div style="margin-left: 15px; width: 200px; height: calc(100% - 30px)">
                <el-checkbox v-model="appendChangeRowFloat" style="margin-top: 20px; display: block">追加时自动换行</el-checkbox>
                <div style="margin-top: 20px">
                  <span style="color: blue">说明:<br />单击为追加<br />双击为替换</span>
                </div>
              </div>
            </td>
          </tr>
        </table>
      </div>
    </rm-floatwindow>
    <!--按钮悬浮窗-->
    <rm-floatwindow v-rm-drag-window2 :visible="dialogbuttonfloatwindowVisible" :winStyle="floatwindowstyle4"
      :showClose="false" type="1" title="" @close="FloatClose($event, '4')" @rowcolchange="Buttonrowcolchange"
      class="buttonfloat" ref="buttonfloat">
      <div>
        <table style="width: 100%; background-color: #e6e6e6" v-if="ButtonListflag">
          <tr>
            <td v-for="(item, index) in ButtonList" style="width: 50px; text-align: center" :key="index">
              <el-button @click="item.onClick" type="310" size="mini">{{ item.title }}</el-button>
            </td>
          </tr>
        </table>
        <table style="width: 100%; background-color: #e6e6e6" v-else>
          <tr v-for="(item, index) in ButtonList" :key="index">
            <td style="width: 50px; text-align: center">
              <el-button @click="item.onClick" type="310" size="mini">{{ item.title }}</el-button>
            </td>
          </tr>
        </table>
      </div>
    </rm-floatwindow>
    <!--报告pdf显示-->
    <rm-floatwindow v-rm-drag-window :visible="reportpdfwindowVisible" :winStyle="floatwindowstyle6" title="报告pdf"
      @close="FloatClose($event, '6')" :showExportBtn="true" @exportReportPDF="exportReportPDF()">
      <div v-if="reportpdfmsg != ''" style="width:100%;height:100%;text-align:center;font-size:30px;"><span
          style="color:blue;">{{ reportpdfmsg }}</span></div>
      <div v-else v-html="reportpdfelement" style="height:98%"></div>
    </rm-floatwindow>
    <!--报告项目复查结果选择开窗-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="报告项目常见结果选择"
      :visible.sync="dialogrechkResultVisible" v-if="dialogrechkResultVisible">
      <el-container style="border: 1px solid #eee;height:600px">
        <el-main style="overflow: hidden;padding:0 0">
          <el-input @keyup.enter.native="rechkResultSearchkeydown" placeholder="快速检索" prefix-icon="el-icon-search"
            ref="rechkqcodeinput" style="width:300px;" v-model="rechkResultqcode"></el-input>
          <el-button @click="rechkResultok" icon="el-icon-circle-check" style="margin-left:10px;">确定</el-button>
          <el-button @click="rechkResultcancel" icon="el-icon-circle-close">取消</el-button>
          <div style="height: 564px">
            <vxe-table :data="tablerechkDataResultS" @cell-dblclick="rechkResultSelect" border height="564px"
              highlight-current-row highlight-hover-row resizable size="mini" status-msg-group="none" stripe
              style="margin-top:10px" ref="xTablerechkResultAll">
              <vxe-table-column field="textvalue" title="文字结果" width="200px"></vxe-table-column>
              <vxe-table-column field="result_flag" title="结果标志" width="60px"></vxe-table-column>
              <vxe-table-column field="redoflag" title="复查标志" width="60px"></vxe-table-column>
              <vxe-table-column field="inputcode" title="快速输入码" width="80px"></vxe-table-column>
              <vxe-table-column field="seq" title="序号" width="40px"></vxe-table-column>
              <vxe-table-column field="containtext" title="录入码" width="80px"></vxe-table-column>
            </vxe-table>
          </div>
        </el-main>
      </el-container>
    </el-dialog>


    <!--按钮配置弹窗-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="按钮配置"
      :visible.sync="dialogButtonConfigVisible" v-if="dialogButtonConfigVisible" width="600px">
      <table style="width: 100%">
        <tr>
          <td>
            <div>
              <vxe-table :data="ButtonListAll" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }"
                @current-change="currentChangeEvent" height="300px" highlight-current-row highlight-hover-row resizable
                highlight-hover-column border show-header-overflow="tooltip" show-overflow="tooltip" header-align="center"
                size="mini" ref="buttontable" stripe width="400px">
                <vxe-table-column type="index" width="45" align="center"></vxe-table-column>
                <vxe-table-column field="name" title="按钮名称" width="100px"></vxe-table-column>
                <vxe-table-column field="title" title="显示名称" width="60px" align="center"></vxe-table-column>
                <vxe-table-column field="visible" title="可见" width="60px" align="center">
                  <template v-slot="{ row }">
                    <el-checkbox v-model="row.visible" true-label="1" false-label="0"></el-checkbox>
                  </template>
                </vxe-table-column>
              </vxe-table>
            </div>
          </td>
          <td width="80">
            <div style="width: 100px; text-align: right">
              <el-button @click="ButtonConfirm()" style="margin-bottom: 10px">确定</el-button>
              <el-button @click="dialogButtonConfigVisible = false" style="margin-bottom: 10px">取消</el-button>
              <el-button @click="SetFirst($refs.buttontable)" style="margin-bottom: 10px">首位</el-button>
              <el-button @click="SetUp($refs.buttontable)" style="margin-bottom: 10px">上移</el-button>
              <el-button @click="SetDown($refs.buttontable)" style="margin-bottom: 10px">下移</el-button>
              <el-button @click="SetLast($refs.buttontable)" style="margin-bottom: 10px">末位</el-button>
              <el-button @click="resort($refs.buttontable)">默认顺序</el-button>
            </div>
          </td>
        </tr>
      </table>
    </el-dialog>
    <!--指定为质控标本弹窗-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="选择质控品"
      :visible.sync="dialogToQcVisible" v-if="dialogToQcVisible" width="800px">
      <rm_rptcom_toQCSample :rptunitid="rptunitid" :reportid="PatientInfo.reportid" ref="ToQcdialog"
        @close="closeqcsampledialog"></rm_rptcom_toQCSample>
    </el-dialog>
    <!--标本退回-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="请选择退回原因"
      :visible.sync="dialogSmpCancelVisible" v-if="dialogSmpCancelVisible" width=" 900px">
      <div style="height: 500px; width: 100%;">
        <div style="height: 500px; width: 520px; float:left;">
          <rm-pop-common style="height: 500px;" @cancel="dialogSmpCancelVisible = false" datatype="seccode"
            kindno="REFUSEREASON" @change="SampleCancelSubmit"></rm-pop-common>
        </div>
        <div style="height: 500px; width:calc(100% - 530px); float:left;">
          <el-button icon="el-icon-camera" style="float:right; margin-right:10px; margin-top:3px; margin-bottom:15%;"
            @click="btnTakePhoto()">拍照</el-button>
          <el-carousel trigger="click" style="height: 70%; width: 100%;" height="100%" :autoplay="false">
            <el-carousel-item v-for="(item, i) in LPicData" :key="i">
              <div style="position:relative; height: 100%; width: 100%;">
                <el-button style="z-index:3000; float: right; position: absolute; top: 85%; right: 8%;" type="danger"
                  @click="deletepic(item)" icon="el-icon-delete" circle></el-button>
                <el-image :src="item" @click="onPreview(item)" style=" width: 100%; height: 99%;"></el-image>
              </div>
            </el-carousel-item>
          </el-carousel>
        </div>
        <el-image-viewer v-if="showViewer" :on-close="closeViewer" :url-list="viewerList" />
      </div>
    </el-dialog>
    <!--标本退回临床通知人-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="请选择电话通知人"
      :visible.sync="dialogCancelNotifierVisible" v-if="dialogCancelNotifierVisible">
      <rm-pop-common ref="popcom" @change="diagUserInfoChange" @cancel="dialogCancelNotifierVisible = false"
        datatype="userinfo"></rm-pop-common>
    </el-dialog>

    <!--自动审核结论查询弹窗   -->

    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="自动审核结论"
      :visible.sync="dialogAutochkVisible" v-if="dialogAutochkVisible" width="600px">
      <div style="border: 1px solid #ccc; padding: 5px">
        <div>
          自动审核结果：<span :style="{ color: AutoCheckResult.indexOf('不') > -1 ? 'red' : 'blue' }">{{ AutoCheckResult }}</span>
        </div>
        <div v-show="AutoCheckResult.indexOf('不') > -1">原因：</div>
        <div style="padding-left: 20px">
          <div v-for="(item, index) in AutoCheckResultReason" :key="index">{{ index + 1 }}.{{ item }}</div>
        </div>
      </div>
      <el-radio-group v-model="similarflag" @change="similiarchange" style="padding-top: 20px">
        <div>
          <el-radio :label="1">与人工相符</el-radio>
          <el-radio :label="2">与人工不符，原因</el-radio>
        </div>
      </el-radio-group>
       <el-input v-model="unsimilarreason" type="textarea" :rows="3" :disabled="similarflag == 1"
        @dblclick.native="AutochkReviewEdit()" style="padding-top: 5px" ref="autoreason"></el-input>
      <div style="width: 100%; text-align: right; padding-top: 5px">
        <el-button @click="CheckReportRe('1')">确 定</el-button>
        <el-button @click="dialogAutochkVisible = false">取 消</el-button>
      </div>
    </el-dialog>

    <!--混样条码解除审核弹窗  -->

    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="删除混样明细报告"
      :visible.sync="dialogMixDelVisible" v-if="dialogMixDelVisible" width="700px">
      <div style="color: blue">当前标本是一个混样标本,为了避免误发报告,解除审核前需先把混样明细对应的报告单先删除</div>
      <vxe-table :data="tableDataMixbarcode" :select-config="{ tigger: 'row' }" :sort-config="{ trigger: 'cell' }"
        :scroll-y="{ rHeight: '50px' }" height="auto" highlight-current-row highlight-hover-row ref="xTableMixDel"
        resizable highlight-hover-column border show-header-overflow="ellipsis" show-overflow="ellipsis"
        header-align="center" :loading="loadingstatus" size="mini" width="100%">
        <vxe-table-column field="rechkflag" title="审" width="30px" sortable align="center">
          <template v-slot="{ row }">
            <div v-if="row.rechkflag == '9'" style="color: blue; font-weight: bold">审</div>
            <div v-else></div>
          </template>
        </vxe-table-column>
        <vxe-table-column field="print_count" title="印" width="30px" sortable align="center">
          <template v-slot="{ row }">
            <div v-if="row.print_count > 0" style="font-weight: bold">印</div>
            <div v-else></div>
          </template>
        </vxe-table-column>
        <vxe-table-column field="barcode" title="条码号" width="100px" sortable></vxe-table-column>
        <vxe-table-column field="rptunitname" title="报告单元" width="100px" sortable align="center"></vxe-table-column>
        <vxe-table-column field="sampleno" title="标本编号" width="80px" sortable align="center"></vxe-table-column>
        <vxe-table-column field="cp_msg" title="消息" width="120px" sortable></vxe-table-column>
        <vxe-table-column field="pat_no" title="病人号" width="80px" sortable></vxe-table-column>
        <vxe-table-column field="pat_name" title="病人姓名" width="80px" sortable align="center"></vxe-table-column>
        <vxe-table-column field="rechk_username" title="审核人" width="80px" sortable align="center"></vxe-table-column>
        <vxe-table-column field="reportid" title="报告ID" width="160px" sortable align="center"></vxe-table-column>
      </vxe-table>
      <div style="width: 100%; text-align: right; padding-top: 5px">
        <el-button @click="UnCheckReportMixData()">删除以上报告</el-button>
        <el-button @click="dialogMixDelVisible = false">取 消</el-button>
      </div>
    </el-dialog>

    <!--弹窗选择报告单元(进入页面专用)-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :close-on-press-escape="false"
      :visible.sync="dialogUnitVisible" v-if="dialogUnitVisible" title="请选择报告单元" :destroy-on-close="true"
      :show-close="false">
      <span slot="title" style="text-align: right">
        <el-button @click="btnCancel">取 消</el-button>
      </span>
      <rm-pop-rptunit ref="pop" :beforeChange="beforeChange" @change="poprptunitchange" :prgno="PRGNO"
        :pfulldata="fulldata"></rm-pop-rptunit>
    </el-dialog>

    <!--解除审核原因框-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="解除审核原因" ref="uncheckdialog"
      :visible.sync="dialogUnCkeclReasonVisible">
      <div v-if="inputkeycode">
        <el-input type="textarea" rows="5" v-model="unreasoncheckmsg" @dblclick.native="msgDblClick"
          placeholder="双击开窗选择解除审核原因" @input="uncheckInput"></el-input>
      </div>
      <div style="text-align: right">
        <el-button @click="$refs.uncheckdialog.Confirm()" :disabled="SingleSubmitdisabled">确 定</el-button>
        <el-button @click="$refs.uncheckdialog.Cancel()">取 消</el-button>
      </div>
      <!--LIS3_xxx-->
    </el-dialog>

    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="解除审核原因"
      :visible.sync="dialogUncheckReasonDataVisible" v-if="dialogUncheckReasonDataVisible">
      <rm-pop-common datatype="seccode" kindno="RPTUNCHKREASON" dataname="解除审核原因"
        @cancel="dialogUncheckReasonDataVisible = false" @change="Uncheckchange"></rm-pop-common>
    </el-dialog>

    <!--审核者注销弹窗-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="注销审核者"
      :visible.sync="dialogUnCheckUserVisible" v-if="dialogUnCheckUserVisible" width="400px">
      <!-- <div style="color: blue">你是否要将当天所有未审核报告的核对医生置空?<br>选择"是" 则清空所有未审核报告<br>选择"否" 仅清空系统记录的核对医生<br>选择"取消" 不做任何操作</div> -->
      <div class="el-message-box__content">
        <div class="el-message-box__status el-icon-warning"></div>
        <div class="el-message-box__message">
          <p>是否要清空审核者信息?</p>
        </div>
      </div>
      <!-- <span class="el-icon-info">是否要清空当天所有未审核报告的核对医生?</span> -->
      <div style="width: 100%; text-align: right; padding-top: 5px">
        <el-button @click="UnCheckUserAll()">清空所有未审核报告</el-button>
        <el-button @click="UnCheckUserAction()">清空系统记录审核者</el-button>
        <el-button @click="dialogUnCheckUserVisible = false">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog width="1000px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="标记结果需复查"
      :visible.sync="multreviewShow" v-if="multreviewShow">
      <rm-labreportmultreview :txtrptunit="rptunitid" :sampledatetime="selectdate"
        @close="multreviewShow = false"></rm-labreportmultreview>
    </el-dialog>

    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="结果消息提醒"
      :visible.sync="dialogListTipsVisible" v-if="dialogListTipsVisible" width="1350px">
      <div v-show="tableDataoncharge.length > 0">
        <span style="font-weight: bold; padding-bottom: 5px">未计价报告</span>
        <vxe-table :data="tableDataoncharge" :select-config="{ tigger: 'row' }" :sort-config="{ trigger: 'cell' }"
          :scroll-y="{ rHeight: '50px' }" height="auto" highlight-current-row resizable border
          show-header-overflow="ellipsis" show-overflow="ellipsis" header-align="center" size="mini" width="100%">
          <vxe-table-column field="barcode" title="条码号" width="80px" sortable></vxe-table-column>
          <vxe-table-column field="sampledate" title="标本日期" width="100px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="sampleno" title="标本编号" width="60px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="pat_no" title="病人号" width="80px" sortable></vxe-table-column>
          <vxe-table-column field="pat_name" title="姓名" width="50px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="pat_sex" title="性别" width="40px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="charge_username" title="计价人" width="80px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="charge_dt" title="计价时间" width="120px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="chargefailcnt" title="计价失败次数" width="80px" sortable align="right"
            header-align="center"></vxe-table-column>
          <vxe-table-column field="chargefailmsg" title="计价失败信息" width="120px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="base_amount" title="基本金额" width="80px" sortable align="right"
            header-align="center"></vxe-table-column>
          <vxe-table-column field="amount" title="金额" width="60px" sortable align="right"
            header-align="center"></vxe-table-column>
          <vxe-table-column field="sample_items" title="申请项目(简称)" width="160px" sortable
            align="center"></vxe-table-column>
        </vxe-table>
      </div>
      <div v-show="tableDataOvertime.length > 0">
        <span style="font-weight: bold; padding-bottom: 5px">超时报告</span>
        <vxe-table :data="tableDataOvertime" :select-config="{ tigger: 'row' }" :sort-config="{ trigger: 'cell' }"
          :scroll-y="{ rHeight: '50px' }" height="auto" highlight-current-row resizable border
          show-header-overflow="ellipsis" show-overflow="ellipsis" header-align="center" size="mini" width="100%">
          <vxe-table-column field="barcode" title="条码号" width="80px" sortable></vxe-table-column>
          <vxe-table-column field="sampledate" title="标本日期" width="100px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="sampleno" title="标本编号" width="60px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="pat_no" title="病人号" width="80px" sortable></vxe-table-column>
          <vxe-table-column field="pat_name" title="姓名" width="50px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="pat_sex" title="性别" width="40px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="recieve_dt" title="签收时间" width="120px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="recieve_username" title="签收人" width="80px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="input_dt" title="录入时间" width="120px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="input_username" title="录入人" width="80px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="prereport_dt" title="预出报告时间" width="120px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="prereport_dt1" title="预出报告时间1" width="120px" sortable
            align="center"></vxe-table-column>
          <vxe-table-column field="req_reason" title="送检目的" width="250px" sortable align="center"></vxe-table-column>
        </vxe-table>
      </div>
      <div v-show="tableDatarptMark.length > 0">
        <span style="font-weight: bold; padding-bottom: 5px">已标记报告</span>
        <vxe-table :data="tableDatarptMark" :select-config="{ tigger: 'row' }" :sort-config="{ trigger: 'cell' }"
          :scroll-y="{ rHeight: '50px' }" height="auto" highlight-current-row resizable border
          show-header-overflow="ellipsis" show-overflow="ellipsis" header-align="center" size="mini" width="100%">
          <vxe-table-column field="barcode" title="条码号" width="80px" sortable></vxe-table-column>
          <vxe-table-column field="sampledate" title="标本日期" width="100px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="sampleno" title="标本编号" width="60px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="pat_no" title="病人号" width="80px" sortable></vxe-table-column>
          <vxe-table-column field="pat_name" title="姓名" width="50px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="pat_sex" title="性别" width="40px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="log_date" title="标记时间" width="120px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="log_username" title="标记人" width="80px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="markno" title="标记类型" width="80px" sortable align="center"></vxe-table-column>
        </vxe-table>
      </div>
      <div style="width: 100%; text-align: right; padding-top: 5px">
        <el-button @click="dialogListTipsVisible = false">确定</el-button>
      </div>
    </el-dialog>

    <el-dialog width="auto" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="文件导入"
      v-if="importDialog" :visible.sync="importDialog" @close="RefreshList">
      <rmLabReportImport prono="LIS310" importdest="RPT" :sampledate="selectdate" :rptunitid="rptunitid"
        @change="fileChange"></rmLabReportImport>
    </el-dialog>

    <el-dialog width="auto" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="待回收标本"
      v-if="specialretdataVisible" :visible.sync="specialretdataVisible">
      <div>
        <span style="font-weight: bold; padding-bottom: 5px">待回收标本</span>
        <vxe-table :data="mspecialretdata" :select-config="{ tigger: 'row' }" :sort-config="{ trigger: 'cell' }"
          :scroll-y="{ rHeight: '50px' }" height="auto" highlight-current-row resizable border
          show-header-overflow="ellipsis" show-overflow="ellipsis" header-align="center" size="mini" width="100%">
          <vxe-table-column field="barcode" title="条码号" width="120px" sortable></vxe-table-column>
          <vxe-table-column field="pat_no" title="病人号" width="80px" sortable></vxe-table-column>
          <vxe-table-column field="pat_name" title="姓名" width="50px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="pat_sexname" title="性别" width="40px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="pat_agestr" title="年龄" width="40px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="pat_typename" title="病人类型" width="60px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="req_statname" title="状态" width="60px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="sample_items" title="申请项目(简称)" width="120px" sortable
            align="center"></vxe-table-column>
          <vxe-table-column field="create_dt" title="创建时间" width="120px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="create_username" title="创建人" width="60px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="recieve_dt" title="接收时间" width="120px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="recieve_username" title="接收人" width="60px" sortable align="center"></vxe-table-column>
          <vxe-table-column field="specimen_name" title="标本类型" width="80px" sortable align="center"></vxe-table-column>
        </vxe-table>
      </div>
      <div style="width: 100%; text-align: right; padding-top: 5px">
        <el-button @click="specialretdataVisible = false">确定</el-button>
      </div>
    </el-dialog>

    <rm-floatwindow v-rm-drag-window2 :visible="synccheckvisible" :winStyle="floatwindowstyle5" :showClose="true"
      title="异步审核消息" @close="FloatClose($event, '5')" class="buttonfloat" ref="buttonfloat">
      <div style="font-size: 16px; color: blue">审核成功：{{ syncchecksuccess }}</div>
      <div
        style="overflow-y: auto; height: 300px; color: red; font-weight: bold; font-size: 16px; width: 400px; white-space: pre-line">
        {{ syncchecktxt }}
      </div>
    </rm-floatwindow>

    <el-dialog width="auto" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="已使用标本号"
      v-if="showsamplenoVisible" :visible.sync="showsamplenoVisible">
      <div style="width: 300px; height: 200px">
        <vxe-table :data="showsamplenoData" :select-config="{ tigger: 'row' }" @cell-dblclick="showsampleDblClick"
          :sort-config="{ trigger: 'cell' }" :scroll-y="{ rHeight: '50px' }" height="auto" highlight-current-row resizable
          border show-header-overflow="ellipsis" show-overflow="ellipsis" header-align="center" size="mini" width="100%">
          <vxe-table-column field="startno" title="开始标本号" width="80px" sortable></vxe-table-column>
          <vxe-table-column field="endno" title="结束标本号" width="80px" sortable></vxe-table-column>
          <vxe-table-column field="num" title="数量" width="50px" sortable align="center"></vxe-table-column>
        </vxe-table>
      </div>
      <div style="width: 100%; text-align: right; padding-top: 5px">
        <el-button @click="ShowInusedSampleno">刷新</el-button>
        <el-button @click="showsamplenoVisible = false">关闭</el-button>
      </div>
    </el-dialog>

    <el-dialog width="auto" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="常用电话"
      v-if="dialogPhoneVisible" :visible.sync="dialogPhoneVisible">
      <div>
        <span style="text-align: left; width: 60px; font-size: 14px; color: blue">申请科室</span>
        <span style="padding-left: 10px; width: 100px; font-size: 12px">{{ phoneShowdata.deptname }}</span>
        <span style="padding-left: 10px; font-size: 12px">{{ phoneShowdata.deptphone }}</span>
        <el-divider></el-divider>
        <span style="text-align: left; width: 60px; font-size: 14px; color: blue">病人病区</span>
        <span style="padding-left: 10px; width: 100px; font-size: 12px">{{ phoneShowdata.wardname }}</span>
        <span style="padding-left: 10px; font-size: 12px">{{ phoneShowdata.wardphone }}</span>
        <el-divider></el-divider>
        <span style="text-align: left; width: 60px; font-size: 14px; color: blue">申请医生</span>
        <span style="padding-left: 10px; width: 100px; font-size: 12px">{{ phoneShowdata.doctorname }}</span>
        <span style="padding-left: 10px; font-size: 12px">{{ phoneShowdata.doctorphone }}</span>
      </div>
      <!-- <tr>
                  <td >申请科室</td>
                  <td ></td>
                  <td style="padding-left: 10px">{{ phoneShowdata.deptphone }}</td>
              </tr>
              <tr>
                  <td style="text-align: left;width: 60px;font-size: 14px;color: blue">病人病区</td>
                  <td style="padding-left: 10px">{{ phoneShowdata.wardname }}</td>
                  <td style="padding-left: 10px">{{ phoneShowdata.wardphone }}</td>
              </tr>
              <tr>
                  <td style="text-align: left;width: 60px;font-size: 14px;color: blue">申请医生</td>
                  <td style="padding-left: 10px">{{ phoneShowdata.doctorname }}</td>
                  <td style="padding-left: 10px">{{ phoneShowdata.doctorphone }}</td>
              </tr>
          </table> -->
      <div style="width: 300px; height: 200px; padding-top: 5px">
        <vxe-table :data="tableDataPhonenum" :select-config="{ tigger: 'row' }" :sort-config="{ trigger: 'cell' }"
          :scroll-y="{ rHeight: '50px' }" height="auto" highlight-current-row resizable border
          show-header-overflow="ellipsis" show-overflow="ellipsis" header-align="center" size="mini" width="100%">
          <vxe-table-column field="codeno" title="常用电话号码" width="120px" sortable></vxe-table-column>
          <vxe-table-column field="codena" title="备注说明" width="160px" sortable></vxe-table-column>
        </vxe-table>
      </div>
      <div style="width: 100%; text-align: right; padding-top: 5px">
        <el-button @click="dialogPhoneVisible = false">返回</el-button>
      </div>
    </el-dialog>

    <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="multichktitle"
      :visible.sync="dialogMultipleVisible" :destroy-on-close="true" v-if="dialogMultipleVisible">
      <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :rptunitid="rptunitid" :name="fieldname"
        :datatype="multidatatype" :rightValue="multivalue" @change="closedialog"></rm-SqlMultiple>
    </el-dialog>
    <!-- 批量录入标本弹窗 -->
    <rmLabreportBatchcollect ref="rmLabreportBatchcollect"></rmLabreportBatchcollect>

    <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname" :datatype="multidatatype"
      :rightValue="multivalue" @change="closedialog" @loadoption="loadsqloption" :rptunitid="rptunitid" ref="MultiSql"
      v-show="false"></rm-SqlMultiple>
    <!-- 特殊患者关注项目提醒 -->
    <el-dialog width="auto" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="特殊患者关注项目"
      v-if="showConcernItemVisible" :visible.sync="showConcernItemVisible">
      <div style="width: 660px; height: 300px">
        <table class="special-pat">
          <tr>
            <td>病人号：</td>
            <td colspan="3">{{ PatientInfo.pat_no }}</td>
          </tr>
          <tr>
            <td>病人姓名：</td>
            <td colspan="3">{{ PatientInfo.pat_name }}</td>
          </tr>
          <tr>
            <td>就诊卡号：</td>
            <td colspan="3">{{ PatientInfo.pat_cardno }}</td>
          </tr>
          <tr>
            <td>性别：</td>
            <td>{{ PatientInfo.pat_sexname }}</td>
            <td>年龄：</td>
            <td>{{ PatientInfo.pat_agestr }}</td>
          </tr>
          <tr>
            <td>身份证：</td>
            <td colspan="3">{{ PatientInfo.pat_idcardno }}</td>
          </tr>
        </table>
        <div style="margin-top:10px;">
          <vxe-table :data="showConcernItemData" :select-config="{ tigger: 'row' }" :sort-config="{ trigger: 'cell' }"
            highlight-current-row resizable border header-align="center" size="mini" width="100%"
            :cell-class-name="ColumnClassNameSpecial" :scroll-y="{ enabled: false }">
            <vxe-table-column field="rpt_itemname" title="关注项目" width="180px" sortable></vxe-table-column>
            <vxe-table-column field="concern_reason" title="关注原因" width="350px" sortable></vxe-table-column>
            <vxe-table-column field="deadline_dt" title="关注截止日期" width="120px" :formatter="format"
              sortable></vxe-table-column>
          </vxe-table>
        </div>
      </div>
      <div style="width: 100%; text-align: right; padding-top: 5px">
        <el-button @click="showConcernItemVisible = false">关闭</el-button>
      </div>
    </el-dialog>
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="loginreasontitle"
      :visible.sync="dialogLoginReasonVisible" ref="loginreasoninput" @close="$refs.loginreasoninput.Cancel()"
      width="400px">
      <table style="border: 1px solid #eee; width: 100%">
        <tr v-if="Options.loginwhendelete == '3'">
          <td>用户代码</td>
          <td>
            <el-input v-model="loginusercode" @blur="getdelusername" @keyup.enter.native="getdelusername"></el-input>
          </td>
        </tr>
        <tr v-if="Options.loginwhendelete == '3'">
          <td>用户姓名</td>
          <td>
            <el-input v-model="loginusername"></el-input>
          </td>
        </tr>
        <tr v-if="Options.loginwhendelete == '3'">
          <td>密码</td>
          <td>
            <el-input placeholder="请输入密码" v-model="loginuserpwd" show-password ref="loginpwd"></el-input>
          </td>
        </tr>
        <tr>
          <td>删除原因</td>
          <td>
            <el-input type="textarea" row="3" placeholder="请输入删除原因" v-model="delreason" ref="delreason"></el-input>
          </td>
        </tr>
      </table>
      <div style="text-align: right; margin-top: 2px">
        <span class="dialog-footer" slot="footer">
          <el-button @click="$refs.loginreasoninput.Confirm()">确认</el-button>
          <el-button @click="$refs.loginreasoninput.Cancel()">取消</el-button>
        </span>
      </div>
    </el-dialog>
    <!--当前标本指定复查结果-->
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="指定复查结果"
      :visible.sync="specifyRedoResultVisible" v-if="specifyRedoResultVisible" width="550px">
      <div style="height: 160px;line-height:2">
        <span style="font-size: 18px;">将此标本作为复查结果指定到样本号：</span>
        <el-input v-model="specifytosample" style="width:100px;" ref="tosampleinput"></el-input>
        <br />
        <span style="font-size: 18px;">或(选填一个即可)</span>
        <br />
        <span style="font-size: 18px;">将样本号：</span>
        <el-input v-model="specifyfromsample" style="width:100px;"></el-input>
        <span style="font-size: 18px;">的结果作为复查结果指定到当前样本</span>
        <br />
        <br />
        <el-checkbox v-model="nocovercurresult"><span style="font-size: 18px;">不覆盖当前结果</span></el-checkbox>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="ConfirmSpecifyRedo()">确定</el-button>
        <el-button @click="specifyRedoResultVisible = false">取消</el-button>
      </span>
    </el-dialog>
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="项目结果输出"
      :visible.sync="itemResultExportVisible" v-if="itemResultExportVisible" width="750px">
      <rm-pop-exportitem :exportrptitem="exportrptitem" :exportrptitemname="exportrptitemname" :rptunitid="rptunitid"
        :rpattypeOption="Options.pattypeOptions" :sampledate="selectdate" @cancel="LinkItemCancel"></rm-pop-exportitem>
    </el-dialog>
    <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="关联项目结果输出"
      :visible.sync="linkItemResultExportVisible" v-if="linkItemResultExportVisible" width="750px">
      <rm-pop-exportlinkitem :linkrptunitid="rptunitid" :linkrptunitname="Options.rptunit.rptunitname"
        :rpattypeOption="Options.pattypeOptions" :sampledate="selectdate"
        @cancel="LinkItemReturn"></rm-pop-exportlinkitem>
    </el-dialog>
  </div>
</template>
<script>
import { Promise } from "q";
import echarts from "echarts";
import XE from "xe-utils";
import md5 from "js-md5";
import Contextmenu from "vue-contextmenujs";
import rmLabReportCollect from "./rm_Lab_Report_Sub/Collect";
import rmLabreportBatchcollect from "./rm_Lab_Report_Sub/BatchCollect";
import rmLabReportConfig from "./rm_Lab_Report_Sub/Config";
import rmLabReportReq from "./rm_Lab_Report_Sub/REQ";
import rmLabReportImport from "./rm_Lab_Report_Sub/RptImport";
import RmSelecttable from "./rm_selecttable.vue";
import ElImageViewer from '../../element-ui/packages/image/src/image-viewer';
import axios from "axios";

export default {
  props: ["PRGNO", "btndisabled"],
  model: {
    prop: "btndisabled",
    // v-model 监听 watch 事件
    event: "watch",
  },
  data() {
    return {
      pageinitloading: false, //页面初始化加载标志
      selectdate: "", //选中日期
      lockselectdate: false, //锁定日期使其不随刷新而改变
      sysdate: "",
      pickerOptions: {
        shortcuts: [
          {
            text: "今天",
            onClick(picker) {
              picker.$emit("pick", XE.toDateString(new Date(), "yyyy-MM-dd 00:00:00"));
            },
          },
        ],
      }, //日期配置将时间切换到当天
      expireTimeOption: {
        shortcuts: [
          {
            text: "今天",
            onClick(picker) {
              picker.$emit("pick", XE.toDateString(new Date(), "yyyy-MM-dd 00:00:00"));
            },
          },
        ],
        disabledDate(date) {
          //disabledDate 文档上：设置禁用状态，参数为当前日期，要求返回 Boolean
          return date.getTime() > Date.now();
        }
      },
      olddate: "", //记录日期更改前时间，保存出错返回olddate
      rptunitid: 0, //当前报告单元id
      oldrptunitid: 0, //旧报告单元id，切换报告单元出错返回
      specno: "1", //当前标本编号
      // btnchilddisabled: this.btndisabled,
      changeflag: false, //result和med发生改变标志
      checkingflag: false, //正在审核标志

      listStatus: "", //过滤条件
      listsearchkey: "", //列表查找关键字
      oldbarcode: "", //旧条码号
      curtabindex: 1, //tab页记录index

      imgUrl: "", //审核签收标志图片地址

      Options: {}, //选项

      ColData: [], //左侧显示列数据
      ColTotalData: [], //左侧全部显示列数据
      ColelseDataShow: false, //显示报告全部列标志
      tableDataColumn: [], //设置弹窗的全部列数据
      tableDataInputMdl: [], //输入TAB页的数据
      tableColumnInputMdl: [], //输入TAB页的列
      loadingColumn: false, //设置的加载标志
      loadingMdl: false, //输入模板的加载标志
      InputMsg: [], //消息列表的需要输入内容的消息数组
      inmsg: "", //输入消息单条
      tooltipsdiable: false, //左侧列显示提示标志
      tooltipcontent: "", //左侧列显示的提示内容

      //DetailVisible: false, //查看全部报告信息显示标志
      dialogTableVisible: false, //左侧通用弹窗
      dialogAgeVisible: false, //年龄编辑框显示标志
      poppatient: {}, //his接口返回申请项目对应病人信息
      PatientInfo: {}, //病人信息
      OldPatientInfo: {}, //旧病人信息
      barcodePatientInfo: {}, //有提示消息时需要确认才显示的病人信息
      barcodeResult: [], //提示消息时需要确认才显示的病人项目结果
      barcodeinputsuccessflag: false,//确认条码输入成功
      selectConfig: { tigger: "row" }, //vxe表格选中方式
      keyConfig: {
        isDel: true,
        isTab: true,
        isEdit: true,
      }, //vxe表格键盘事件
      currentindex: 0, //当前设置页选中行index
      copystr: "", //复制内容
      copycode: "", //复制的代码
      copytype: "", //复制的字段类型

      poptitle: "", //左侧列表通用弹出框标题
      popdatatype: "LIS3_charge_typeno", //左侧列表通用弹出框类型
      //列表tab
      pagebylist: false, //按列表翻页标志
      myreport: false, //我的报告(所有)标志
      mygreport: false, //本组报告标志
      myunitreport: false, //我的报告（本单元）标志
      myreportname: "我的报告", //我的报告或本组报告显示文字
      rptunitgroup: "",
      rptunitgroupfilter: [], //单元组合筛选条件
      tableDataList: [], //右侧列表全部数据
      tableDataListS: [], //右侧列表关键字筛选后数据
      tableListColumn: [], //右侧列表显示列
      loadingList: false, //右侧列表加载标志
      showpagenation: true, //是否展示分页
      tableListPage: {
        currentPage: 1,
        pageSize: 5000,
        totalResult: 0,
      }, //右侧列表分页数据
      ExactNum: 0, //已审核数量
      UnExactNum: 0, //未审核数量
      TotalPatNum: 0, //全部报告数量
      CASignNum: 0, //异步审核的报告数量
      NeedRedoNum: 0, //需复查报告数量
      HasRedoNum: 0, //已复查报告数量
      HasOverTimeNum: 0,//已超时报告数量
      NowPatNum: 0, //当前报告位置
      SpecAddflag: 1, //标本添加标志
      tempRowIndex: -1, //当前行号
      Patredoflag: false, //复查显示标志
      PatHistoryNum: 0, //历史结果数量
      showPatHistoryNum: 0,
      HistoryTitle: "历史结果", //历史结果tab页标题
      tabvalue: "1", //当前tab的value,用来控制tab页跳转
      //年龄弹出框
      inputfatherage: "", //主要年龄
      inputsonage: "", //次要年龄
      radiofatherunit: "岁", //主要年龄单位
      radiosonunit: "月", //次要年龄单位
      reagestrch: "", //写入年龄中文
      reagestren: "", //写入年龄英文
      //列配置弹出框
      Tablist: "1,3,4,5,6", //显示的tab页列表
      ConfigDetail: {}, //tab页配置选项 2021-03-19 mod by yangl 改成json对象，方便后续再增加选项
      //用户登录弹出框
      usercode: "", //登录用户名
      username: "", //登录用户显示名
      userpwd: "", //登录密码
      specinuseflag: "1", //样本修改选择标志
      specinuseflaginrecord: "1", //全局标志判断审核人的修改
      dialogLoginVisible: false, //登录框显示标志
      specrange: "", //适用标本区间
      exactusernorhk: "", //审核人
      exactusernamerhk: "", //审核人名
      exactusernoreport: "", //报告人
      exactusernamereport: "", //报告人名
      //申请项目选择弹出框
      rpt_itemall: false, //his申请项目全选
      showallrptitem: false, //显示所有项目标志
      dialogRptItemVisible: false, //his接口返回申请项目开窗标志
      HisReAppDate: "", //his申请项目日期区间
      tableDataHisReturn: [], //his申请项目显示数据
      tableDataHisReturnAll: [], //his申请项目全部数据
      tableColumnHisReturn: [], //his申请项目数据列
      //危急值上报弹出框
      dialogDangerVisible: false, //危急值弹出框标志
      CurrentCheckUser: { userno: "", username: "" }, //当前审核用户
      CurrentReportUser: { userno: "", username: "" }, //当前检验用户
      dangerreportid: "", //当前危急值reportid
      //图像tab
      ImageList: [], //图像列表
      ImageIndex: [], //图像index
      ImageDiff: false, //图片发生更改标志
      imagecomm: "", //图片备注
      selectimage: "", //选中图像
      selectname: "", //选中图像名称
      selectclearimage: "", //选中图像清晰图片
      selectseq: "", //选中图像序号
      advicetype: "1", //图像结果选择类型
      //申请tab
      tableDataApplyUp: [], //申请TAB页上部数据
      tableDataApplyDown: [], //申请TAB页下部数据
      tableColumnApplyUp: [], //申请TAB页上部数据列
      tableColumnApplyDown: [], //申请TAB页下部数据列
      reqitemlist: "", //申请项目显示文字
      reqamount: 0, //申请项目显示金额
      reqnum: 0, //申请项目显示数量
      reqitemtabvalue: "a", //申请项目对应报告项目或收费项目tab值
      tableDataApplyFee: [], //申请项目对应收费项目
      //历史结果tab
      HistoryLeftList: [], //历史结果左侧项目列表
      HistoryLeftAllList: [], //历史结果左侧所有项目列表
      tableDataHistory: [], //历史结果数据最多7列
      tableDataHistoryTotal: [], //历史结果全部数据
      tableDataHistoryMed: [], //历史结果细菌药敏数据
      tableColumnHistory: [], //历史结果数据列
      tableColumnHistoryTotal: [], //历史结果全部数据列
      loadingHistory: false, //历史结果加载标志
      charts: "", //历史结果图线
      ShowButtonHistory: "隐藏", //历史结果显示隐藏文字
      GermHistoryflag: false, //细菌历史结果标志
      CurveShow: true, //历史结果波动图显示标志
      searchgermflag: ['1', '2', '3', '4'], //细菌历史结果查询标志
      historySelectClass: "",//历史结果选择的单元分类（用于跳转后定位）
      //仪器诊断TAB
      tabinstrresult: "仪器诊断", //仪器诊断还未做
      //复查TAB
      tableDataRechk: [], //复查结果数据
      tableDataRechkDetail: [], //复查结果明细数据显示
      tableDataRechkDetailAll: [], //复查结果全部明细数据
      tableColumnRechkDetail: [], //复查结果明细数据列
      loadingRechk: false, //复查结果加载标志
      loadingRechkDetail: false, //复查结果明细加载标志
      //通讯TAB
      tableDataCommunite: [], //通讯数据
      tableColumnCommunite: [], //通讯数据列
      loadingCommunite: false, //通讯数据加载标志
      //样本图像TAB
      sampleImageList: [], //样本图像数据
      selectsampleimage: "",
      SampleImageIndex: [], //图像index
      //历史结果查看全部弹窗
      dialogHistoryVisible: false, //历史结果全部弹窗的显示标志
      tableDataHistoryDialog: [], //历史结果全部弹窗数据
      tableColumnHistoryDialog: [], //历史结果全部数据列
      loadingHistoryDialog: false, //历史结果弹窗数据加载标志
      resultw: "400px", //结果控件默认宽度
      //DDL快速输入码
      InputCodeArr: [], //ddl数据列表
      //change与快捷键同步标志
      changekeyflag: false, //数据改变标志
      execSpecNoChange: 0, //标本号改变正在加载标志
      Refreshflag: true, //正在刷新标志
      //查看操作日志弹出框
      dialogReportLogVisible: false, //检验报告操作日志显示窗
      ReportLogid: "", //检验报告操作日志对应报告ID
      logid: +new Date(),
      //布局宽度
      fixleft: 230, //左侧数据布局宽度
      fixright: 600, //右侧列表默认宽度
      //列表条件选择框
      Customfilter: [], //列表筛选文字显示
      ListSearchFilter: { Checkflag: "全部", Printflag: "全部", Emerflag: "全部", Rechkflag: "全部", Completeflag: "全部", Chargeflag: "全部", Custom: "", Markflag: "全部", OverTimeflag: "全部", Signflag: "全部", Nucleinflag: "全部", Exceptionflag: "全部" }, //列表筛选条件数组
      ListSearchpattype: "全部", //列表筛选病人类型
      ListSearchOtherflag: "全部", //列表筛选其他分类
      filtervisible: false, //列表筛选显示
      markvisible: false, //标记显示
      mredoflag: "", //复查标记
      mredoflagname: "", //复查标记名称
      mmarkflag: "", //标记
      mmarkflagname: "", //自定义标记名
      mspecialflag: "", //特殊病人标记
      mspecialretdata: [], //特殊病人回收标本数据
      specialretdataVisible: false, //特殊病人回收标本数据显示标志
      mspecialflagname: "",
      editflag: true, //可编辑标志
      //消息提示框
      dialogMsgVisible: false, //可回看消息弹窗
      msgtitle: "提示", //消息标题
      msgcontent: "", //消息内容
      Submitdisabled: true, //回看消息可不可提交标志
      SingleSubmitdisabled: true,
      msglist: [], //消息列表
      NowMsgNo: 0, //当前消息序号
      TotalMsgNo: 0, //全部消息数量
      MsgAllOver: true, //消息看到最后标志
      //报告描述结果
      appendChangeRow: false, //报告文字描述结果行追加标志
      dialogAdviceVisible: false, //报告文字描述结果显示标志
      loadingAdvice: false, //报告文字描述结果加载标志
      tableDataAdvice: [], //报告文字描述结果显示数据
      tableDataAdviceAll: [], //报告文字描述结果全部数据
      advicetxt: "", //报告文字描述结果文字
      advicesearchtxt: "", //报告文字描述结果查询关键字
      //单项合并弹窗
      dialogmergeVisible: false, //单项合并弹窗
      mergespecno: "", //合并后标本号
      mergemethod: "1", //标本号识别方式
      tableDatamergeLeft: [], //单项合并查询结果
      tableDatamergeRight: [], //单项合并可合并项目
      RightSaveArr: [], //临时保存得到的有数据行
      //标本合并弹窗
      dialogmergespecVisible: false, //标本合并弹窗显示标志
      //申请tab修改弹出框
      dialogreqVisible: false, //申请tab双击弹窗显示标志
      tableDataDialogreqSelect: [], //选中的申请数据
      tableDataDialogreqAll: [], //全部申请数据
      dialogreqtype: "", //判断弹窗由检验目的打开还是申请tab页打开
      //复查结果输入弹窗
      dialogRechkDetailVisible: false, //复查结果输入弹窗标志
      tableReChkDetailDialog: [], //复查结果数据
      ReChkDetailOverride: false, //复查结果存在即覆盖
      //标记需复查弹窗
      dialogNeedRechkVisible: false, //标记需复查弹窗标志
      tableDataRedo: [], //标记需复查数据
      //报告删除弹窗
      dialogDelVisible: false, //报告删除弹窗显示标志
      RResultRunning: true, //移除监听
      //批次审核弹窗
      dialogBactchRechkVisible: false, //批次审核弹窗显示标志
      ctrll: false,
      shiftl: false,
      BatRechkDate: "", //质控日期
      BatRechkSampleno: "", //批次审核标本号
      BatRechkPatType: "", //批次审核病人类型
      pattypeOption: [], //病人类型列表
      showRedo: "0", //不显示需复查报告
      isautoprint: "0", // 审核后自动打印
      BatRechkTableData: [], //批次审核数据
      BatRechkloading: false, //查找审核行加载标志
      CheckRows: [], //待审核的行
      checkindex: 0, //当前审核到的index
      checksuccess: 0, //批次审核成功数量
      checkfail: 0, //批次审核失败数量
      checkcafail: 0, //批次审核ca签名失败数量
      batsignmode: 0, //批次签名标志
      //指定为质控标本弹窗
      dialogToQcVisible: false, //指定为质控标本弹窗显示标志
      //图像浮动窗口
      dialogimgfloatwindowVisible: false, //图像浮动窗口显示标志
      floatwindowstyle1: "top:100px;left:50%;width:200px;height:400px", //图像浮动窗口回传样式
      //样本图像浮动窗口
      dialogsampleimgfloatwindowVisible: false, //样本图像浮动窗口显示标志
      floatwindowstyle2: "top:100px;left:calc(50% + 20px );width:200px;height:400px", //样本图像浮动窗口回传样式
      //检验意见悬浮窗
      floatadvicetitle: "检验意见", //检验意见悬浮窗标题
      txtadvice: "", //检验意见悬浮窗文字
      dialogAdvicefloatwindowVisible: false, //检验意见浮动窗口显示标志
      appendChangeRowFloat: false, //检验意见浮动窗口追加行标志
      advicesearchtxtFloat: "", //检验意见浮动窗口关键词查询
      floatwindowstyle3: "top:100px;left:calc(50% + 40px );width:550px;height:400px", //检验意见浮动窗口回传样式
      //今日危急值
      dialogtodaydangerVisible: false, //今日危急值显示标志
      //合并当前病人结果
      dialogpatmergerptVisible: false, //合并当前病人结果显示标志
      //标本退回
      dialogSmpCancelVisible: false, //标本退回显示标志
      dialogCancelNotifierVisible: false,//标本退回临床通知人显示标志
      CancelReason: "", //标本退回原因代码
      Tellman: "",//标本退回临床通知人
      //右键菜单
      RightItemAll: [
        {
          label: "解除审核",
          field: "Uncheck",
          onClick: () => {
            this.BeforeUnCheckReport(this.exactusernoreport);
          },
        },
        {
          label: "审核者注销",
          field: "WriteOff",
          onClick: () => {
            this.UnCheckUser();
          },
        },
        {
          label: "批次审核",
          field: "BatchCheck",
          onClick: () => {
            this.BatchCheck();
          },
        },
        {
          label: "今日危急值",
          field: "TodayDanger",
          onClick: () => {
            this.ShowTodayDanger();
          },
        },
        // {
        //     label: "撤销结果删除",
        //     field: "CancelDel",
        //     onClick: () => {
        //         this.$refs.rmlabresult.CancelDel();
        //     },
        // },
        // {
        //     label: "合并当前病人结果",
        //     field: "MergeCurPat",
        //     onClick: () => {
        //         this.MergeNowPat();
        //     },
        // },
        {
          label: "显示按钮浮动窗",
          field: "ShowButton",
          onClick: () => {
            this.ShowFloatButton();
          },
        },
        {
          label: "输入复查结果",
          field: "InputRedo",
          onClick: () => {
            this.InputRechkDetail();
          },
        },
        {
          label: "标记需复查结果",
          field: "SignRedo",
          onClick: () => {
            this.OpenRechkNeed();
          },
        },
        {
          label: "显示图像浮动窗口",
          field: "ShowImg",
          onClick: () => {
            this.OpenImageFloat();
          },
        },
        {
          label: "显示样本图像浮动窗口",
          field: "ShowSmpImg",
          onClick: () => {
            this.OpenSampleImageFloat();
          },
        },
        {
          label: "补打条码",
          field: "RePrtBarcode",
          onClick: () => {
            this.RePrintBarcode();
          },
        },
        {
          label: "查看日志",
          field: "Log",
          onClick: () => {
            this.QueryReportLog();
          },
        },
        {
          label: "报告预览",
          field: "reportreview",
          onClick: () => {
            this.CheckPrint(2);
          },
        },
        {
          label: "查阅病历",
          onClick: () => {
            this.QueryPatCase();
          },
        },
        {
          label: "清除未做",
          onClick: () => {
            this.ClearNoDoItems();
          },
        },
        {
          label: "标本合并(移动)",
          onClick: () => {
            this.OpenLIS322();
          },
        },
        {
          label: "单项合并",
          onClick: () => {
            this.OpenMerge();
          },
        },
        {
          label: "清除打印标志",
          onClick: () => {
            this.ClearPrintFlag();
          },
        },
        {
          label: "指定为质控标本",
          onClick: () => {
            this.SetQcSample();
          },
        },
        {
          label: "设置",
          onClick: () => {
            this.OpenConfig();
          },
        },
        {
          label: "批量录入标本",
          onClick: () => {
            this.BatchInputSample();
          },
        },
      ], //右键菜单默认配置
      //按钮拖动框
      dialogbuttonfloatwindowVisible: false, //按钮拖动框显示标志
      floatwindowstyle4: "top:300px;left:calc(50% - 20px )", //按钮拖动框回传样式
      ButtonListAll: [
        {
          title: "上",
          name: "上一个",
          visible: "0",
          onClick: () => {
            this.SpecnoExchange(0, 0);
          },
          field: "1",
        },
        {
          title: "下",
          name: "下一个",
          visible: "0",
          onClick: () => {
            this.SpecnoExchange(1, 0);
          },
          field: "2",
        },
        {
          title: "审",
          name: "审核",
          visible: "0",
          onClick: () => {
            this.CheckReport();
          },
          field: "3",
        },
        {
          title: "印",
          name: "打印",
          visible: "0",
          onClick: () => {
            this.CheckPrint(1);
          },
          field: "4",
        },
        {
          title: "增",
          name: "增加",
          visible: "0",
          onClick: () => {
            this.$refs.rmlabresult.ResultAddAsync();
          },
          field: "5",
        },
        {
          title: "删",
          name: "删除",
          visible: "0",
          onClick: () => {
            this.$refs.rmlabresult.ResultDelAsync();
          },
          field: "6",
        },
        {
          title: "存",
          name: "保存",
          visible: "0",
          onClick: () => {
            this.SaveReportandResult(2, this.selectdate, this.rptunitid, "", 1);
          },
          field: "7",
        },
        {
          title: "解",
          name: "解除审核",
          visible: "0",
          onClick: () => {
            this.BeforeUnCheckReport(this.exactusernoreport);
          },
          field: "8",
        },
        {
          title: "设",
          name: "设置按钮",
          visible: "0",
          onClick: () => {
            this.ConfigButton();
          },
          field: "0",
        },
        {
          title: "关",
          name: "关闭",
          visible: "0",
          onClick: () => {
            this.FloatClose(this.$refs.buttonfloat.$el.style, "4");
          },
          field: "-1",
        },
      ], //按钮默认全部数据
      ButtonList: [], //可见的按钮浮动按钮
      ButtonListflag: true, //可见的按钮浮动横排竖排显示按钮
      dialogButtonConfigVisible: false, //按钮浮动配置可显示标志
      currenbuttonindex: 0, //当前移动的按钮index
      logcontent: "",
      chktitleflag: false,
      //待检样本
      loadingSmp: false,
      tableDataSmp: [],
      //tableDataSmpAll: [],
      tableDataSmpCount: 0,
      sampledaysingle1: 3, //待检样本默认过滤时间
      sampledaysingle2: 1, //待检样本默认过滤时间
      sampledaysingle3: 1, //待检样本默认过滤时间
      workonmachine: "1",
      samplesearchtxt: "",
      samplereqdetail: "",
      samplerecievedt1: "", //签收时间开始
      samplerecievedt2: "", //签收时间结束
      filtervisibleSmp: false, //待检样本浮动框展示
      SmpSearchFilter: { Stasusflag: ["已签收", "已采样", "已生成", "门诊", "住院", "其他"] },
      SmpStatus: "采样未签收,门诊", //待检样本过滤条件
      CheckingMsgObj: "",
      //自动审核结论弹窗
      dialogAutochkVisible: false,
      AutoCheckResult: "", //自动审核结果
      AutoCheckResultReason: [], //自动审核不通过原因
      similarflag: 1, //与人工相符标志
      unsimilarreason: "",
      //删除混样条码明细弹窗
      dialogMixDelVisible: false,
      tableDataMixbarcode: [],
      MixDatas: [],
      MixIndex: 0,
      //混检条码详细信息
      tableDataMixTab: [],
      loadingMixTab: false,
      // pageid: 0,
      pathlist: [],
      //弹窗报告单元
      dialogUnitVisible: false,
      lis310multiple: "0",
      fulldata: null,
      pagepath: "",
      //解除审核原因开窗
      dialogUnCkeclReasonVisible: false,
      dialogUncheckReasonDataVisible: false,
      inputkeycode: "",
      unreasoncheckmsg: "",
      //审核者注销弹窗
      dialogUnCheckUserVisible: false,
      //右侧列表主键，用于记忆报告 区分LIS310、LIS311
      ListKey: this.PRGNO + "ListTable",
      //批量标记需复查组件显示
      multreviewShow: false,
      //进入审核模式标志
      Begincheckmode: false,
      checkmodefous: false,
      //仪器原始数据
      tableDataInstr: [],
      addOperList: [],
      reportmarks: [],
      specialpattypes: [], //特殊病人类型
      rightZoom: 1,
      centerZoom: 1,
      leftZoom: 1,
      //刷新列表提示弹窗
      dialogListTipsVisible: false,
      tableDataoncharge: [],
      tableDataOvertime: [],
      tableDatarptMark: [],
      specialdiagflag: "0", //特殊诊断标记
      importDialog: false, //报告数据导入
      collapsearr: ["1", "2", "3"],
      //rpttableid: "" //this.PRGNO + "RptList" 还是不赋值tableid了，这样如果两个报告单元显示的列一样，就共用一份本地设置，如果列不一样就取单独的本地设置
      //异步审核相关
      synccheckvisible: false,
      syncchecktxt: "",
      syncreportid: [],
      syncchecksuccess: 0,
      floatwindowstyle5: "top:300px;left:calc(50% - 20px )", //异步审核回传样式
      showsamplenoData: [], //已使用标本号数据
      showsamplenoVisible: false,
      DangerAllflag: false, //单独上报危急值标志
      MedjudgeAction: "", //药敏提示动作
      //常用电话弹窗
      dialogPhoneVisible: false,
      tableDataPhonenum: [],
      phoneShowdata: {
        deptname: "",
        deptphone: "",
        wardname: "",
        wardphone: "",
        doctorname: "",
        doctorphone: "",
      },
      //键盘事件绑定
      keyEvent: {
        lisshortcutkeyf2: 113,
        lisshortcutkeyf3: 114,
        lisshortcutkeyf5: 116,
        lisshortcutkeyf6: 117,
        lisshortcutkeyf7: 118,
        lisshortcutkeyf8: 119,
        lisshortcutkeyf9: 120,
        lisshortcutkeyf11: 122,
        lisshortcutkeypageup: 33,
        lisshortcutkeypagedown: 34,
      },
      //多选弹窗
      dialogMultipleVisible: false,
      option1: [],
      option2: [],
      fieldname: "",
      multidatatype: "", //多选弹窗类型
      multivalue: "", //多选弹窗值
      reqitemloading: true,
      reqitemOption: [],
      reqitem: "",
      timeoutid: 0,
      locktime: 0,
      isalwaysrechkuser: 0,
      reject_userno: "",
      loadingstatus: false,
      mixdatamsgcontent: "", // 混样明细的审核解除原因
      loginsucessedflag: false, //判断已经登录成功（混样审核解除用）
      //日志
      tableDataRptLogDetail: [],
      RptLogDetailloading: false,

      rechktextvalueshow: false,
      dialogrechkResultVisible: false,
      tablerechkDataResultS: [],
      rechkResultqcode: "",
      iconclass: "el-icon-arrow-down",
      tableDataResultAll: [],
      //危急值项目
      alteritemData: [],//危急值项目数据
      Alteritemloading: false,
      alertiteminfo: [],//所有危急值项目数据
      activities: [],//危急值项目活动数据
      redomodifyloginsuccessflag: false,//修改复查结果登录成功标志
      markreasonpasseditflag: true,//待查原因确认是否可编辑标志
      tableDataMsgDialog: [],//消息提示弹窗数据
      loadingMsgDialog: false,//消息提示弹窗加载中
      dialogMsgListVisible: false,//消息提示弹窗显示
      showInputColumn: false,//显示输入内容列
      canUpdateRedoResultflag: false,//可修改复查结果标志
      isallowsync: "1",//是否允许同步标志
      showConcernItemVisible: false,//显示关注项目提醒
      showConcernItemData: [],//关注项目
      specnoinputrptunit: [],//可以从标本编号输入的报告单元
      selrptunitlist: "",//历史结果报告单元筛选条件
      specialtypena: "",//特殊病人标记
      basecolor: "#FFFFFF",
      reportpdfwindowVisible: false,
      floatwindowstyle6: "top:50%;left:230px;width:50%;height:47%",
      reportpdfelement: "",
      reportpdfmsg: "",
      reportpdfurl: "",
      //删除原因与工号验证
      loginreasontitle: "",
      dialogLoginReasonVisible: false,
      loginusercode: "",
      loginusername: "",
      loginuserpwd: "",
      delreason: "",
      rolerptunitlist: [],//当前用户权限内的报告单元列表
      nottodayalertflag: true,//报告录入时，当选择的日期不是今天，给提示
      deptwardtelnum: "",
      specifyRedoResultVisible: false,
      specifytosample: "",
      specifyfromsample: "",
      nocovercurresult: false,
      itemResultExportVisible: false,
      exportrptitem: "",
      exportrptitemname: "",
      exceptionvisible: false,
      multiitemData: [],
      showViewer: false,
      viewerList: [],
      LPicData: [],
      reqrejectimage: "",
      mustPhotoStr: "",
      historyuncheckrpts: "",
      pattypeinfo: [],
      reqgroupinfo: [],
      linkItemResultExportVisible: false,
      redoreasonoptions: [],
      hasreasonoptionflag: false,
    };
  }, //按钮浮动窗显示配置
  components: { rmLabReportCollect, rmLabReportConfig, rmLabReportImport, rmLabReportReq, rmLabreportBatchcollect, ElImageViewer },
  created() {
    //this.$route.meta.title = "报告-免疫";
    //this.$router.push({ name: this.PRGNO, params: { rptunitid: this.rptunitid } });
    this.lis310multiple = this.$tool.getLocalConfig("lis310multiple");
    // 获取当前用户权限内的报告单元
    this.GetRoleRptunit();
  },
  mounted() {
    // 监听body上的点击
    document.querySelector("body").addEventListener("click", this.closeMenu);
    window.addEventListener("mousewheel", this.handleScroll, false);
    // if (this.$route.fullPath == "/LIS310") {
    //     this.$router.replace("/LIS310?id=" + 1);
    //     this.$bus.$on("tagsChange", path => {
    //         this.pathlist = path.list;
    //         this.$router.replace(path.path);
    //     });
    this.$bus.$off("closetag");
    this.$bus.$on("closetag", (tag) => {
      var pageinfo = this.$tool.getSession("RptPageInfo");
      if (pageinfo) {
        pageinfo = JSON.parse(pageinfo);
        if (pageinfo.length > 0) {
          var index = pageinfo.findIndex((item) => item.path == tag.path);
          if (index > -1) {
            pageinfo.splice(index, 1);
            this.$tool.setSession("RptPageInfo", JSON.stringify(pageinfo));
          }
        }
      }
    });

    this.$bus.$on("imagecatch", (imgbase64) => {
      if (this.dialogSmpCancelVisible == true) {
        this.rej_imagecatch(imgbase64);
      } else {
        this.imagecatch(imgbase64);
      }
    });

    this.RResult(this.$route.fullPath, this);
    this.InitPageData();
    if (document.onkeydown == null) {
      this.RegKeyEvent(this);
    }
  },
  beforeDestroy() {
    this.$bus.$off("imagecatch");
    this.$bus.$off("closetag");
    this.RResultRunning = false;
    // 移除监听
    document.querySelector("body").removeEventListener("click", this.closeMenu);
    window.removeEventListener("mousewheel", this.handleScroll, false);
    localStorage.setItem("RM_LAB_REPORT_FIXWIDTH", this.$refs.layoutright.fixsizeLocal);
    this.SaveLocalReportSmpFilter();
    // var pageinfo = this.$tool.getSession("RptPageInfo");
    // if (pageinfo) {
    //     pageinfo = JSON.parse(pageinfo);
    //     if (pageinfo.length > 0) {
    //         var index = pageinfo.findIndex(item => item.path == this.pagepath);
    //         if (index > -1) {
    //             pageinfo.splice(index, 1);
    //             this.$tool.setSession("RptPageInfo", JSON.stringify(pageinfo));
    //         }
    //     }
    // }
    this.$tool.statusbarMsg(3, "");
  },
  destroyed() { },
  updated() {
    // if (this.$refs.leftdiv) {
    //     if (this.$refs.leftdiv.clientWidth > 245) this.resultw = this.$refs.leftdiv.clientWidth - 245 + "px";
    // }
  },
  methods: {
    // #region 通用方法库

    // #region 审核相关
    // 审核后续
    CheckThen(res, tp, rechkuser) {
      return new Promise((s, f) => {
        this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :checkthen方法开始: " + res.reporttoca.reportid + "\r\n";
        //this.$pub.Log("checkthen方法开始:" + res.reporttoca.reportid);
        if (this.Options.rechkreportsyncmode == "1") {
          this.CheckThenAction(res)
            .then(() => {
              s();
            })
            .catch(() => {
              this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :checkthenaction失败: " + res.reporttoca.reportid + "\r\n";
              this.$pub.Log(this.logcontent);
              this.logcontent = "";
              f();
            });
        } else {
          if (res.hasOwnProperty("checkca") && res.checkca == "1") {
            //CA信息保存先异步吧，和审核报告区分开来，就算签名失败也不影响审核，以免以后CA出故障导致一直无法审核报告
            let chkuser = rechkuser;
            if (!chkuser) {
              chkuser = !this.PatientInfo.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernorhk : this.PatientInfo.rechk_user;
              if (this.Options.rechkcoverechkuser == "1") {
                chkuser = this.exactusernorhk;
              }
            }
            //var chkuser = this.PatientInfo.rechk_user ? this.PatientInfo.rechk_user : this.exactusernorhk;
            this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :开始电子签名: " + res.reporttoca.reportid + "\r\n";
            //CA签名数据保存，不管成功或失败，都不影响审核 加密和保存加密数据都集成到CAsign方法
            this.$ca.CAsign(chkuser, res.reporttoca.data, res.reporttoca.reportid).then((caret) => {
              this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :电子签名结束: " + res.reporttoca.reportid + "\r\n";
              //this.$pub.Log("电子签名结束");
              if (caret.flag != "1") {
                this.$pub.Log("CA签名失败：chkuser=" + chkuser + "reportid = " + res.reporttoca.reportid + ",data=" + res.reporttoca.data);
                this.$alert("CA[电子签名]认证或记录失败，您可以稍后手工补电子签名，或解除审核后重新审核！ " + caret.msg, "CA签名失败！").finally(() => {
                  this.CheckThenAction(res)
                    .then(() => {
                      s();
                    })
                    .catch(() => {
                      this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :checkthenaction失败: " + res.reporttoca.reportid + "\r\n";
                      this.$pub.Log(this.logcontent);
                      this.logcontent = "";
                      f();
                    });
                });
              } else {
                this.CheckThenAction(res)
                  .then(() => {
                    s();
                  })
                  .catch(() => {
                    this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :checkthenaction失败: " + res.reporttoca.reportid + "\r\n";
                    this.$pub.Log(this.logcontent);
                    this.logcontent = "";
                    f();
                  });
              }
            });
          } else {
            this.CheckThenAction(res)
              .then(() => {
                s();
              })
              .catch(() => {
                this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :checkthenaction失败: " + res.reporttoca.reportid + "\r\n";
                this.$pub.Log(this.logcontent);
                this.logcontent = "";
                f();
              });
          }
        }

        // let rechkrow = this.$refs.xTableList.tableFullData.filter((item) => item.sampleno == this.specno && item.sampledate == this.selectdate);
        // if (rechkrow.length > 0) {
        //     rechkrow[0].rechk_dt = redt;
        //     rechkrow[0].rechkflag = "9";
        //     rechkrow[0].rechk_user = this.PatientInfo.rechk_user ? this.PatientInfo.rechk_user : this.exactusernorhk;
        //     rechkrow[0].rechk_username = this.PatientInfo.rechk_username ? this.PatientInfo.rechk_username : this.exactusernamerhk;
        //     this.TotalPatNum = this.$refs.xTableList.tableFullData.length;
        //     this.ExactNum = this.$refs.xTableList.tableFullData.filter((item) => item.rechkflag > 0).length;
        //     this.UnExactNum = this.$refs.xTableList.tableFullData.filter((item) => item.rechkflag == 0).length;

        // } else {

        // }
        //var sampleno = this.specno + "";
        //this.$pub.Log("checkthenfuncdataend:" + Date.now());
        // var row = this.$refs.xTableList.tableFullData.filter((item) => item.sampleno == this.specno && item.sampledate == this.selectdate)[0];
        // this.specno = sampleno;
        // this.PatientInfo = XE.clone(row, true);
        // this.OldPatientInfo = XE.clone(row, true);
        // this.$refs.xTableList.setCurrentRow(row).then(() => {
        // });
      });
    },
    // 审核后续
    CheckThenAction(res) {
      return new Promise((s, f) => {
        //防止审核成功的报告信息更新到当前选中的报告上造成报告误审
        var issign = this.PatientInfo.rechkflag == "0" && this.Options.checkmustsignname == "1" ? "1" : "0";
        var isautonextflag = (issign == "1" && this.Options.autonextaftersign == 0) || (issign != "1" && this.Options.autonextaftercheck == 0);
        //是否自动下一个
        if (isautonextflag && res.reporttoca.reportid == this.PatientInfo.reportid) {
          this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核不自动下一个赋值开始: " + res.reporttoca.reportid + "\r\n";
          //this.$pub.Log("审核不自动下一个赋值开始");
          this.$refs.rmlabresult.editflag = false;
          if (issign == "1") {
            this.PatientInfo.rechkflag = "1";
            this.$emit("title", "审核");
            this.chktitleflag = false;
            this.OldPatientInfo.rechkflag = "1";
            this.imgUrl = require("@/assets/img/signed.png");
            if (this.PatientInfo.autosignflag && this.PatientInfo.autosignflag == "1") this.imgUrl = require("@/assets/img/signedauto.png");
          } else {
            this.PatientInfo.rechkflag = "9";
            this.OldPatientInfo.rechkflag = "9";
            this.imgUrl = require("@/assets/img/checked.png");
            if (this.PatientInfo.autocheckflag && this.PatientInfo.autocheckflag == "1") this.imgUrl = require("@/assets/img/checkedauto.png");
          }
          var redt = res.rechk_dt;
          this.PatientInfo.rechk_dt = redt;
          this.PatientInfo.rechk_user = this.PatientInfo.rechk_user ? this.PatientInfo.rechk_user : this.exactusernorhk;
          this.PatientInfo.rechk_username = this.PatientInfo.rechk_username ? this.PatientInfo.rechk_username : this.exactusernamerhk;
          this.OldPatientInfo.rechk_dt = redt;
          this.OldPatientInfo.rechk_user = this.PatientInfo.rechk_user ? this.PatientInfo.rechk_user : this.exactusernorhk;
          this.OldPatientInfo.rechk_username = this.PatientInfo.rechk_username ? this.PatientInfo.rechk_username : this.exactusernamerhk;
          this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核不自动下一个赋值结束: " + res.reporttoca.reportid + "\r\n";
          //this.$pub.Log("审核不自动下一个赋值结束");
        }
        this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核自动下一个开始: " + res.reporttoca.reportid + "\r\n";
        //this.$pub.Log("审核自动下一个开始");
        // this.$refs.rmlabresult.editflag = false;
        // let that = this;
        // setTimeout(() => {
        //     that.$emit("haschange", true);
        // });
        let chknum = 0;
        let unchknum = 0;
        let rechkrow = "0";
        this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核自动下一个计数循环开始: " + res.reporttoca.reportid + "\r\n";
        //this.$pub.Log("审核自动下一个计数循环开始");
        if (res.reporttoca.reportid == this.PatientInfo.reportid) {
          for (let i = 0; i < this.$refs.xTableList.tableFullData.length; i++) {
            let temprow = this.$refs.xTableList.tableFullData[i];
            if (temprow.sampleno == this.specno && temprow.sampledate == this.selectdate && temprow.rptunitid == this.rptunitid) {
              temprow.rechk_dt = res.rechk_dt;
              //如果是自动下一个那么就要看下审核状态是1还是0了
              if (issign == "1" && ((isautonextflag && this.PatientInfo.rechkflag == "1") || (!isautonextflag && this.PatientInfo.rechkflag == "0"))) {
                temprow.rechkflag = "1";
                temprow.report_user = this.PatientInfo.report_user ? this.PatientInfo.report_user : this.exactusernoreport;
                temprow.report_username = this.PatientInfo.report_username ? this.PatientInfo.report_username : this.exactusernamereport;
              } else {
                temprow.rechkflag = "9";
                temprow.rechk_user = this.PatientInfo.rechk_user ? this.PatientInfo.rechk_user : this.exactusernorhk;
                temprow.rechk_username = this.PatientInfo.rechk_username ? this.PatientInfo.rechk_username : this.exactusernamerhk;
              }

              rechkrow = "1";
              chknum++;
            } else if (temprow.rechkflag == "9") chknum++;
            else unchknum++;
          }
        } else {//防止审核成功的报告信息更新到当前选中的报告上显示出现错误
          let temprow = this.$refs.xTableList.tableFullData.find((item) => item.reportid == res.reporttoca.reportid);
          temprow.rechk_dt = res.rechk_dt;
          if (this.Options.checkmustsignname == "1" && temprow.rechkflag == "0") {
            temprow.rechkflag = "1";
            temprow.report_user = this.exactusernoreport;
            temprow.report_username = this.exactusernamereport;
          } else {
            temprow.rechkflag = "9";
            temprow.rechk_user = this.exactusernorhk;
            temprow.rechk_username = this.exactusernamerhk;
          }
          rechkrow = "1";
          chknum++;
        }
        this.TotalPatNum = chknum + unchknum;
        this.ExactNum = chknum;
        this.UnExactNum = unchknum;
        this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核自动下一个计数循环结束: " + res.reporttoca.reportid + "\r\n";
        //this.$pub.Log("审核自动下一个计数循环结束");
        if (rechkrow != "0") {
          this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :checkthen赋值结束: " + res.reporttoca.reportid + "\r\n";
          //this.$pub.Log("checkthen赋值结束");
          s();
        } else {
          this.PatientInfo.sampleno = this.specno;
          // this.OldPatientInfo = XE.clone(this.PatientInfo, true);
          // this.oldbarcode = this.OldPatientInfo.barcode;
          // var row = this.$refs.xTableList.tableFullData[this.$refs.xTableList.tableFullData.length - 1];
          // this.$refs.xTableList.setCurrentRow(row);
          // this.TotalPatNum = this.$refs.xTableList.tableFullData.length;
          // this.ExactNum = this.$refs.xTableList.tableFullData.filter((item) => item.rechkflag > 0).length;
          // this.UnExactNum = this.$refs.xTableList.tableFullData.filter((item) => item.rechkflag == 0).length;
          // this.tempRowIndex = this.$refs.xTableList.tableFullData.filter((item) => item._XID < row._XID).length;
          this.$refs.rmlabresult.QueryResult(this.PatientInfo).then((res) => {
            if (!res.hasOwnProperty("res")) {
              res.res = res;
              res.redo = "";
              res.history = 0;
            }
            this.Patredoflag = !!res.redo;
            this.PatHistoryNum = res.history;
            if (this.PRGNO == "LIS311") {
              if (res.iscontainBacteria) {
                this.showPatHistoryNum = res.history;
              } else {
                this.showPatHistoryNum = 0;
              }
            } else {
              this.showPatHistoryNum = res.history;
            }
            var row = XE.clone(res.res, true);
            this.PatientInfo = this.PatientInfoGetname(row);
            this.OldPatientInfo = this.PatientInfoGetname(row);
            this.AfterQResult(row.reportid, this);
            this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
            this.tableDataListS.push(JSON.parse(JSON.stringify(this.PatientInfo)));
            this.tableDataList.push(JSON.parse(JSON.stringify(this.PatientInfo)));
            this.CalcNum(this.$refs.xTableList.tableFullData);
            // this.AfterQResult(this.PatientInfo.reportid, this);
            s();
          });

          // this.$refs.xTableList.setCurrentRow(this.PatientInfo).then(() => {
          //     this.CalcNum(this.$refs.xTableList.tableFullData);
          //     // this.TotalPatNum = this.$refs.xTableList.tableFullData.length;
          //     // this.ExactNum = this.$refs.xTableList.tableFullData.filter((item) => item.rechkflag > 0).length;
          //     // this.UnExactNum = this.$refs.xTableList.tableFullData.filter((item) => item.rechkflag == 0).length;
          //     this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :checkthen加载结束: " + this.PatientInfo.reportid + "\r\n";
          //     //this.$pub.Log("checkthen加载结束:" + this.PatientInfo.reportid);
          //     this.$refs.xTableList.updateAfterFullData();
          //     s();
          // });
        }
        // this.btnchilddisabled = true;
      });
    },
    // 审核后续电子签名
    CheckThenCA(res) {
      if (res.hasOwnProperty("checkca") && res.checkca == "1") {
        //CA信息保存先异步吧，和审核报告区分开来，就算签名失败也不影响审核，以免以后CA出故障导致一直无法审核报告
        let chkuser = rechkuser;
        if (!chkuser) {
          chkuser = !this.PatientInfo.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernorhk : this.PatientInfo.rechk_user;
          if (this.Options.rechkcoverechkuser == "1") {
            chkuser = this.exactusernorhk;
          }
        }
        //var chkuser = this.PatientInfo.rechk_user ? this.PatientInfo.rechk_user : this.exactusernorhk;
        this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :开始电子签名: " + this.PatientInfo.reportid + "\r\n";
        //CA签名数据保存，不管成功或失败，都不影响审核 加密和保存加密数据都集成到CAsign方法
        this.$ca.CAsign(chkuser, res.reporttoca.data, res.reporttoca.reportid).then((caret) => {
          this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :电子签名结束: " + this.PatientInfo.reportid + "\r\n";
          //this.$pub.Log("电子签名结束");
          if (caret.flag != "1") {
            this.$pub.Log("CA签名失败：chkuser=" + chkuser + "reportid = " + res.reporttoca.reportid + ",data=" + res.reporttoca.data);
          } else {
            this.CASignNum++;
          }
        });
      }
    },
    // 批次审核报告
    BatCheckReport(type) {
      var rows = [];
      if (type == 1) rows = this.$refs.BatRechkTable.getSelectRecords();
      else rows = this.$refs.xTableList.getSelectRecords();
      this.CheckRows = rows;
      this.checkindex = 0;
      var hasrows = this.CheckRows.filter((item) => item.reportid != "");
      if (hasrows.length == 0) {
        this.$alert("没有选中需要审核的报告!", "提示");
        return;
      }
      var checkrows = [];
      if (this.batsignmode == "0") checkrows = this.CheckRows.filter((item) => item.rechkflag != "9");
      else checkrows = this.CheckRows.filter((item) => item.rechkflag != "1" && item.rechkflag != "9");
      if (checkrows.length == 0) {
        this.$alert("选中报告已经全部审核,无需再审!", "提示");
        return;
      }
      this.checkindex = this.CheckRows.indexOf(checkrows[0]);
      if (this.batsignmode == "0" ? this.exactusernorhk : this.exactusernoreport) {
        this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
      } else {
        this.$rm_Login({
          type: (this.Options.checkmustsignname == "1" && this.CheckRows[this.checkindex].rechkflag == "0") || this.batsignmode == "1" ? "请输入签名者工号和密码" : "请输入审核者工号和密码",
          tipmsg: this.Options.replacechkuserno ? "请输入审核者工号和密码，注意：已设置账号[" + this.Options.replacechkuserno + "]为固定审核人，无论您登录什么工号，最终审核者将被替换成" + this.Options.replacechkuserno : "",
          btn: {
            confirmBtnText: "确定",
            cancelBtnText: "取消",
          },
        })
          .then((res) => {
            if (res.flag == "1") {
              this.checkCaLogin(res.userid).then((cares) => {
                if (cares.flag == "1") {
                  if (this.Options.checkmustsignname == "1" && this.CheckRows[this.checkindex].rechkflag == "0") {
                    this.exactusernoreport = res.userid;
                    this.exactusernamereport = res.username;
                  } else {
                    this.exactusernorhk = res.userid;
                    this.exactusernamerhk = res.username;
                  }
                  this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
                } else {
                  //this.CheckReportRe(0,thenaction, printtype);
                  this.checkingflag = false;
                  this.$alert("CA登录失败！" + cares.msg, "登陆失败", {
                    confirmButtonText: "确定",
                    type: "error",
                  });
                }
              });
            } else {
              //登录失败
            }
          })
          .catch((e) => {
            console.log("error", e);
          });
      }
    },
    //批次审核更新审核人信息等
    BatCheckMsg(type, cpmsg, rckusr, rckflag) {
      //type = 1 成功,type = 2 失败,type = 3审核成功ca失败
      if (type == "1") {

        this.CheckRows[this.checkindex].rechk_dt = this.selectdate;
        this.checksuccess++;
        // 执行打印
        if (this.isautoprint == "1") {
          this.singleprint(this.CheckRows[this.checkindex].reportid);
        }
      } else if (type == "2") {
        this.checkfail++;
      } else if (type == "3") {
        this.CheckRows[this.checkindex].rechk_dt = this.selectdate;
        this.checkcafail++;
        // 执行打印
        if (this.isautoprint == "1") {
          this.singleprint(this.CheckRows[this.checkindex].reportid);
        }
      }
      this.CheckRows[this.checkindex].cp_msg = cpmsg;
      if (rckusr) this.CheckRows[this.checkindex].rechk_user = rckusr;
      if (rckflag) this.CheckRows[this.checkindex].rechkflag = rckflag;
      this.checkindex++;
      if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
      else this.AlertMsg();
    },
    // 批次审核报告之前
    BeforeBatCheckReport(row) {
      //this.xTable1loading = true;
      if (row.cp_msg == "审核成功" || row.cp_msg == "签名成功") {
        this.checkindex++;
        if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
      } else {
        let rckuser = !row.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernorhk : row.rechk_user;
        let rckusername = !row.rechk_username || this.specinuseflaginrecord == "2" ? this.exactusernamerhk : row.rechk_username;
        if (this.Options.rechkcoverechkuser == "1") {
          rckuser = this.exactusernorhk;
          rckusername = this.exactusernamerhk;
        }
        let rptusr = this.Options.checkmustsignname == "1" && row.rechkflag == "0" ? this.exactusernoreport : row.report_user ? row.report_user : this.exactusernoreport;
        let rptusername = this.Options.checkmustsignname == "1" && row.rechkflag == "0" ? this.exactusernamereport : row.report_username ? row.report_username : this.exactusernamereport;
        if (this.Options.rechkcoverreportuser == "1") {
          rptusr = this.exactusernoreport;
          rptusername = this.exactusernamereport;
        }
        this.addOperList = [];
        this.checkCaLogin(rckuser).then((cares) => {
          if (cares.flag == "1") {
            this.$pub.Log("批次审核：检验用户=" + rptusr + ",审核用户=" + rckuser + ",reportid = " + row.reportid);
            this.$tool
              .request({
                url: "LIS/LIS3/LIS310",
                method: "post",
                data: {
                  action: "batcheckreport",
                  reportid: row.reportid,
                  reportuser: rptusr,
                  checkuser: rckuser,
                  signmode: this.batsignmode,
                },
              })
              .then((res) => {
                if (res.flag == 1 || res.flag == 2) {
                  //如果安静模式
                  if (res.alertflag == 1) {
                    this.DangerAllflag = false;
                    this.dangerreportid = row.reportid;
                    this.dialogDangerVisible = true;
                    this.CurrentCheckUser = { userno: rckuser, username: rckusername };
                    this.CurrentReportUser = { userno: rptusr, username: rptusername };
                  } else {
                    //无危急值上报
                    if (res.hasOwnProperty("checkca") && res.checkca == "1") {
                      this.ReportCheckCA(res, rckuser)
                        .then(() => {
                          this.BatCheckMsg("1", "审核成功", rckusername);
                        })
                        .catch(() => {
                          this.BatCheckMsg("3", "审核成功,CA签名失败!", rckusername);
                        });
                    } else {
                      if (this.Begincheckmode && this.batsignmode == "1") {
                        this.BatCheckMsg("1", "签名成功", "", "1");
                      } else {
                        this.BatCheckMsg("1", "审核成功", rckusername, "9");
                      }
                    }
                  }
                } else {
                  let addsql = [];
                  if (res.sqlList) {
                    for (let i = 0; i < res.sqlList.length; i++) {
                      this.addOperList.push(res.sqlList[i].Item1);
                      addsql.push(res.sqlList[i].Item1);
                    }
                  }
                  this.ErrorListDeal(res.msg, res.flag, res.alertflag)
                    .then(() => {
                      if (res.alertflag == "1") {
                        this.DangerAllflag = false;
                        this.dangerreportid = row.reportid;
                        this.dialogDangerVisible = true;
                        this.CurrentCheckUser = { userno: rckuser, username: rckusername };
                        this.CurrentReportUser = { userno: rptusr, username: rptusername };
                      } else {
                        this.BatCheckReportRequest("", "", row, addsql)
                          .then((response) => {
                            if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                              this.ReportCheckCA(response, rckuser)
                                .then(() => {
                                  this.BatCheckMsg("1", "审核成功", rckusername);
                                })
                                .catch(() => {
                                  this.BatCheckMsg("3", "审核成功,CA签名失败!", rckusername);
                                });
                            } else {
                              if (this.Begincheckmode && this.batsignmode == "1") {
                                this.BatCheckMsg("1", "签名成功", "", "1");
                              } else {
                                this.BatCheckMsg("1", "审核成功", rckusername, "9");
                              }
                            }
                          })
                          .catch(() => {
                            if (this.Begincheckmode && this.batsignmode == "1") {
                              this.BatCheckMsg("2", "签名失败");
                            } else {
                              this.BatCheckMsg("2", "审核失败");
                            }
                          });
                      }
                    })
                    .catch(() => {
                      if (this.Begincheckmode && this.batsignmode == "1") {
                        this.BatCheckMsg("2", "签名失败");
                      } else {
                        this.BatCheckMsg("2", "审核失败");
                      }
                    });
                }
              });
          } else {
            if (this.Begincheckmode && this.batsignmode == "1") {
              this.BatCheckMsg("2", "签名失败");
            } else {
              this.BatCheckMsg("2", "审核失败");
            }
          }
        });
      }
    },
    //原版批次审核备份
    // BeforeBatCheckReport(row) {
    //     //this.xTable1loading = true;
    //     if (row.cp_msg == "审核成功" || row.cp_msg == "签名成功") {
    //         this.checkindex++;
    //         if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
    //     } else {
    //         let rckuser = !row.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernorhk : row.rechk_user;
    //         let rckusername = !row.rechk_username || this.specinuseflaginrecord == "2" ? this.exactusernamerhk : row.rechk_username;
    //         if (this.Options.rechkcoverechkuser == "1") {
    //             rckuser = this.exactusernorhk;
    //             rckusername = this.exactusernamerhk;
    //         }
    //         let rptusr = this.Options.checkmustsignname == "1" && row.rechkflag == "0" ? this.exactusernoreport : row.report_user ? row.report_user : this.exactusernoreport;
    //         if (this.Options.rechkcoverreportuser == "1") {
    //             rptusr = this.exactusernoreport;
    //         }
    //         this.$tool
    //             .request({
    //                 url: "LIS/LIS3/LIS310",
    //                 method: "post",
    //                 data: {
    //                     action: "batcheckreport",
    //                     reportid: row.reportid,
    //                     reportuser: rptusr,
    //                     checkuser: rckuser,
    //                     signmode: this.batsignmode
    //                 }
    //             })
    //             .then(res => {
    //                 if (res.flag == 1 || res.flag == 2) {
    //                     //如果安静模式
    //                     if (res.alertflag == 1) {
    //                         this.DangerAllflag = false;
    //                         this.dangerreportid = row.reportid;
    //                         this.dialogDangerVisible = true;
    //                         this.CurrentCheckUser = { userno: rckuser, username: rckusername };
    //                     } else {
    //                         //无危急值上报
    //                         if (res.hasOwnProperty("checkca") && res.checkca == "1") {
    //                             this.ReportCheckCA(res, rckuser)
    //                                 .then(() => {
    //                                     this.CheckRows[this.checkindex].rechk_user = rckusername;
    //                                     this.CheckRows[this.checkindex].rechk_dt = this.selectdate;
    //                                     this.CheckRows[this.checkindex].cp_msg = "审核成功";
    //                                     this.checkindex++;
    //                                     this.checksuccess++;
    //                                     if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
    //                                     else this.AlertMsg();
    //                                 })
    //                                 .catch(() => {
    //                                     this.CheckRows[this.checkindex].rechk_user = rckusername;
    //                                     this.CheckRows[this.checkindex].rechk_dt = this.selectdate;
    //                                     this.CheckRows[this.checkindex].cp_msg = "审核成功,CA签名失败!";
    //                                     this.checkindex++;
    //                                     this.checkcafail++;
    //                                     if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
    //                                     else this.AlertMsg();
    //                                 });
    //                         } else {
    //                             this.CheckRows[this.checkindex].rechk_user = rckusername;
    //                             this.CheckRows[this.checkindex].rechk_dt = this.selectdate;
    //                             if (this.Begincheckmode && this.batsignmode == "1") {
    //                                 this.CheckRows[this.checkindex].cp_msg = "签名成功";
    //                                 this.CheckRows[this.checkindex].rechkflag = "1";
    //                             } else {
    //                                 this.CheckRows[this.checkindex].cp_msg = "审核成功";
    //                                 this.CheckRows[this.checkindex].rechkflag = "9";
    //                             }

    //                             this.checkindex++;
    //                             this.checksuccess++;
    //                             if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
    //                             else this.AlertMsg();
    //                         }
    //                     }
    //                 } else {
    //                     this.ErrorListDeal(res.msg, res.flag, res.alertflag)
    //                         .then(() => {
    //                             if (res.alertflag == "1") {
    //                                 this.DangerAllflag = false;
    //                                 this.dangerreportid = row.reportid;
    //                                 this.dialogDangerVisible = true;
    //                                 this.CurrentCheckUser = { userno: rckuser, username: rckusername };
    //                             } else {
    //                                 this.BatCheckReportRequest("", "", row)
    //                                     .then(response => {
    //                                         if (response.hasOwnProperty("checkca") && response.checkca == "1") {
    //                                             this.ReportCheckCA(response, rckuser)
    //                                                 .then(() => {
    //                                                     this.CheckRows[this.checkindex].rechk_user = rckusername;
    //                                                     this.CheckRows[this.checkindex].rechk_dt = this.selectdate;
    //                                                     this.CheckRows[this.checkindex].cp_msg = "审核成功";
    //                                                     this.checkindex++;
    //                                                     this.checksuccess++;
    //                                                     if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
    //                                                     else this.AlertMsg();
    //                                                 })
    //                                                 .catch(() => {
    //                                                     this.CheckRows[this.checkindex].rechk_user = rckusername;
    //                                                     this.CheckRows[this.checkindex].rechk_dt = this.selectdate;
    //                                                     this.CheckRows[this.checkindex].cp_msg = "审核成功,CA签名失败!";
    //                                                     this.checkindex++;
    //                                                     this.checkcafail++;
    //                                                     if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
    //                                                     else this.AlertMsg();
    //                                                 });
    //                                         } else {
    //                                             if (this.Begincheckmode && this.batsignmode == "1") {
    //                                                 this.CheckRows[this.checkindex].cp_msg = "签名成功";
    //                                                 this.CheckRows[this.checkindex].rechkflag = "1";
    //                                             } else {
    //                                                 this.CheckRows[this.checkindex].cp_msg = "审核成功";
    //                                                 this.CheckRows[this.checkindex].rechk_user = rckusername;
    //                                                 this.CheckRows[this.checkindex].rechk_dt = this.selectdate;
    //                                                 this.CheckRows[this.checkindex].rechkflag = "9";
    //                                             }
    //                                             this.checkindex++;
    //                                             this.checksuccess++;
    //                                             if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
    //                                             else this.AlertMsg();
    //                                         }
    //                                     })
    //                                     .catch(() => {
    //                                         if (this.Begincheckmode && this.batsignmode == "1") {
    //                                             this.CheckRows[this.checkindex].cp_msg = "签名失败";
    //                                         } else {
    //                                             this.CheckRows[this.checkindex].cp_msg = "审核失败";
    //                                         }
    //                                         this.checkfail++;
    //                                         //this.CheckRows[this.checkindex].cp_msg = "审核失败";
    //                                         this.checkindex++;
    //                                         // this.checkfail++;
    //                                         if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
    //                                     });
    //                             }
    //                         })
    //                         .catch(() => {
    //                             if (this.Begincheckmode && this.batsignmode == "1") {
    //                                 this.CheckRows[this.checkindex].cp_msg = "签名失败";
    //                             } else {
    //                                 this.CheckRows[this.checkindex].cp_msg = "审核失败";
    //                             }
    //                             this.checkfail++;
    //                             //this.CheckRows[this.checkindex].cp_msg = "审核失败";
    //                             this.checkindex++;
    //                             //this.checkfail++;
    //                             if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
    //                         });
    //                 }
    //             });
    //     }
    // },
    // 批次审核报告确认
    BatCheckReportRequest(alertreportflag, alertinfo, row, addsql) {
      return new Promise((s, f) => {
        let rckuser = !row.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernorhk : row.rechk_user;
        let rckusername = !row.rechk_username || this.specinuseflaginrecord == "2" ? this.exactusernamerhk : row.rechk_username;
        if (this.Options.rechkcoverechkuser == "1") {
          rckuser = this.exactusernorhk;
          rckusername = this.exactusernamerhk;
        }
        let rptusr = row.report_user ? row.report_user : this.exactusernoreport;
        if (this.Options.rechkcoverreportuser == "1") {
          rptusr = this.exactusernoreport;
        }
        this.$pub.Log("批次审核exec：检验用户=" + rptusr + ",审核用户=" + rckuser + ",reportid = " + row.reportid);
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            data: {
              action: "execcheckreport",
              reportid: row.reportid,
              reportuser: rptusr,
              checkuser: rckuser,
              inputmsg: this.InputMsg,
              alertreportflag: alertreportflag,
              alertinfo: alertinfo,
              issign: this.Begincheckmode ? this.batsignmode : "",
              sqlList: addsql
            },
          })
          .then((res) => {
            this.DangerAllflag = false; //单独上报危急值标志置为false
            if (res.flag == "1") {
              if (this.dialogDangerVisible) {
                this.dialogDangerVisible = false;
                this.CheckRows[this.checkindex].rechk_user = rckusername;
                this.CheckRows[this.checkindex].rechk_dt = this.selectdate;
                if (this.Begincheckmode && this.batsignmode == "1") {
                  this.CheckRows[this.checkindex].cp_msg = "签名成功";
                  this.CheckRows[this.checkindex].rechkflag = "1";
                } else {
                  this.CheckRows[this.checkindex].cp_msg = "审核成功";
                  this.CheckRows[this.checkindex].rechkflag = "9";
                }
                this.checkindex++;
                this.checksuccess++;
                if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
                else this.AlertMsg();
              }
              s(res);
            } else {
              this.ErrorListDeal(res.msg, res.flag)
                .then(() => {
                  f();
                })
                .catch(() => {
                  f();
                });
            }
          })
          .catch((error) => {
            this.DangerAllflag = false; //单独上报危急值标志置为false
            this.$message.error("错误:" + error);
            f();
          });
      });
    },
    // CA签名保存
    ReportCheckCA(res, rechkuser) {
      return new Promise((s, f) => {
        let chkuser = rechkuser;
        if (!chkuser) {
          chkuser = !this.PatientInfo.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernorhk : this.PatientInfo.rechk_user;
          if (this.Options.rechkcoverechkuser == "1") {
            chkuser = this.exactusernorhk;
          }
        }
        this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :开始电子签名: " + res.reporttoca.reportid + "\r\n";
        //CA签名数据保存，不管成功或失败，都不影响审核 加密和保存加密数据都集成到CAsign方法
        this.$ca.CAsign(chkuser, res.reporttoca.data, res.reporttoca.reportid).then((caret) => {
          this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :电子签名结束: " + res.reporttoca.reportid + "\r\n";
          //this.$pub.Log("电子签名结束");
          if (caret.flag != "1") {
            this.$pub.Log("CA签名失败：chkuser=" + chkuser + "reportid = " + res.reporttoca.reportid + ",data=" + res.reporttoca.data);
            f();
          } else {
            s();
          }
        });
      });
    },
    //批次审核完成弹出消息
    AlertMsg() {
      var confirmmsg = "审核";
      if (this.Begincheckmode && this.batsignmode == "1") {
        confirmmsg = "签名";
      }
      if (this.checkcafail > 0) {
        this.$alert("选中报告全部" + confirmmsg + "完毕!" + this.checksuccess + "条" + confirmmsg + "成功," + this.checkfail + "条" + confirmmsg + "失败," + this.checkcafail + "条" + confirmmsg + "成功,CA签名失败", "提示")
          .then(() => {
            if (this.checkfail > 0) this.AlertRefreshList();
          })
          .catch(() => {
            if (this.checkfail > 0) this.AlertRefreshList();
          });
      } else {
        this.$alert("选中报告全部" + confirmmsg + "完毕!" + this.checksuccess + "条" + confirmmsg + "成功," + this.checkfail + "条" + confirmmsg + "失败", "提示")
          .then(() => {
            if (this.checkfail > 0) this.AlertRefreshList();
          })
          .catch(() => {
            if (this.checkfail > 0) this.AlertRefreshList();
          });
      }
    },
    // 弹出后刷新列表
    AlertRefreshList() {
      if (this.Begincheckmode && this.batsignmode == "1") {
        this.tableDataListS = this.tableDataListS.filter((item) => item.hasOwnProperty("cp_msg") && item.cp_msg && item.cp_msg.indexOf("失败") > -1);
        this.tableDataList = XE.clone(this.tableDataListS, true);
        this.checksuccess = 0;
        this.CheckRows = this.$refs.xTableList.getSelectRecords();
      }
    },
    // 多少时间没操作，注销审核者重新登陆
    RefreshLock() {
      clearTimeout(this.timeoutid);
      if (this.locktime && this.locktime > 0) {
        this.timeoutid = setTimeout(() => {
          this.exactusernorhk = "";
          this.exactusernamerhk = "";
        }, (this.locktime - 0) * 60 * 1000);
      }
    },
    //审核报告前提示
    BeforeCheckTips(type, thenaction, ptype) {
      //type = 0 检查患者病人号和病人姓名
      //type = 1 检查未做项目
      switch (type) {
        case 0:
          if (this.PatientInfo.pat_no == "" && this.PatientInfo.pat_name == "") {
            this.$confirm("当前患者没有病人号和病人姓名，确定要继续" + (this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0" ? "签名" : "审核") + "吗?", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              focusCancelButton: true,
              closeOnClickModal: false,
              type: "warning",
            }).then(() => {
              this.BeforeCheckTips(1, thenaction, ptype);
            });
          } else {
            this.BeforeCheckTips(1, thenaction, ptype);
          }
          break;
        case 1:
          if (this.$refs.rmlabresult.$refs.xTableResult.tableFullData.find((item) => item.result_str == "未做") && this.Options.clearpendingbeforerechk == "1") {
            console.log("未做");
            this.$confirm("当前患者有项目未做，确定清除未做项目吗?", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              focusCancelButton: true,
              closeOnClickModal: false,
              type: "warning",
            }).then(() => {
              this.$refs.rmlabresult.ClearNoDoItems().then(() => {
                this.SaveAction(0, this.selectdate, this.rptunitid).then(() => {
                  this.BeforeCheckTips(2, thenaction, ptype);
                });
              });
            });
          } else {
            this.BeforeCheckTips(2, thenaction, ptype);
          }
          break;
        default:
          var resultdatas = this.$refs.rmlabresult.$refs.xTableResult.tableFullData;
          if (resultdatas.length > 0 || this.PRGNO == "LIS311" || this.PRGNO == "LIS312") {
            let mustlogin = false;
            if (this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0") {
              //签名模式下，获取检验医生逻辑
              let reportuser = this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0" ? this.exactusernoreport : this.PatientInfo.report_user ? this.PatientInfo.report_user : this.exactusernoreport;
              if (!reportuser) {
                mustlogin = true;
              }
            } else {
              //审核模式下，获取审核医生的逻辑 都应该封装起来
              let rckuser = !this.PatientInfo.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernorhk : this.PatientInfo.rechk_user;
              if (this.Options.rechkcoverechkuser == "1") {
                rckuser = this.exactusernorhk;
              }
              if (!rckuser) {
                mustlogin = true;
              }
            }
            if (!mustlogin) {
              this.BeforeCheckReport(thenaction, ptype);
            } else {
              //只有启用CA并且验证审核者登录时直接使用CA登录打开才需要直接ca登录
              if (this.Options.useca == "1" && this.Options.checkloginuseca == "1") {
                if (typeof jsObj != "undefined") {
                  try {
                    let operhis = this.$tool.getSession(this.$tool.selectedhis);
                    this.calogin(this.Options.caparams, operhis)
                      .then((cares) => {
                        if (cares.flag != "1") {
                          this.$message.error(cares.msg);
                          this.commonLogin(thenaction, ptype);
                        } else {
                          if (this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0") {
                            this.exactusernoreport = cares.data.userno;
                            this.exactusernamereport = cares.data.username;
                          } else {
                            this.exactusernorhk = cares.data.userno;
                            this.exactusernamerhk = cares.data.username;
                          }
                          console.log(cares);
                          //后面的checkCaLogin就可以不跑了
                          this.BeforeCheckReport(thenaction, ptype, "1");
                        }
                      });
                  } catch (err) {
                    this.$message.error("CA登录失败，请输入工号密码登录！" + err);
                    this.commonLogin(thenaction, ptype);
                  }
                } else {
                  that.$alert("系统已启用CA,请在" + this.$pub.clientname + "登录！", "登陆失败", {
                    confirmButtonText: "确定",
                    type: "error",
                  });
                }
              } else {
                this.commonLogin(thenaction, ptype);
              }
            }
          } else {
            this.$confirm("当前报告无检验结果无法审核!", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              focusCancelButton: false,
              closeOnClickModal: false,
              type: "warning",
            });
          }
      }
    },
    commonLogin(thenaction, ptype) {
      this.$rm_Login({
        type: this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0" ? "请输入签名者工号和密码" : "请输入审核者工号和密码",
        tipmsg: this.Options.replacechkuserno ? "请输入审核者工号和密码，注意：已设置账号[" + this.Options.replacechkuserno + "]为固定审核人，无论您登录什么工号，最终审核者将被替换成" + this.Options.replacechkuserno : "",
        btn: {
          confirmBtnText: "确定",
          cancelBtnText: "取消",
        },
      })
        .then((res) => {
          if (res.flag == "1") {
            if (this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0") {
              this.exactusernoreport = res.userid;
              this.exactusernamereport = res.username;
            } else {
              this.exactusernorhk = res.userid;
              this.exactusernamerhk = res.username;
            }
            this.BeforeCheckReport(thenaction, ptype);
          } else {
            //登录失败
            this.$message.error("登录失败，请重新输入工号密码登录！");
          }
        })
        .catch((e) => {
          console.log("error", e);
        });
    },
    calogin(caparams, operhis) {
      return new Promise((s, f) => {
        var computername = "";
        var computeInfo = jsObj.GetComputeInfo();
        var arr = computeInfo.split("\r");
        if (arr.length == 3) {
          computername = arr[2];
        }
        let chkRetjson = "";
        if (caparams.caclassname.toUpperCase() == "RMINTERFACE.CASZT.BLLCA") {
          chkRetjson = jsObj.CALoginParas(caparams.caclassname, caparams.caparm1, caparams.caparm2, caparams.caparm3, caparams.caparm4, caparams.caparm5, "", "");
        } else {
          chkRetjson = jsObj.CALoginParasEx(caparams.caclassname, caparams.caparm1, caparams.caparm2, caparams.caparm3, caparams.caparm4, caparams.caparm5, "", "", "1");
        }
        let chkRet = JSON.parse(chkRetjson);
        if (chkRet.code == "-2" || chkRet.code == "-1" || chkRet.code == "-3" || chkRet.code == "-9") {
          s({
            flag: "-1",
            msg: "CA登录失败：" + chkRet.keyid
          })
        } else {
          if (chkRet.keyid)//如果有keyid，则用keyid去找对应的用户信息
          {
            this.$tool
              .request({
                url: "/ucent/login",
                method: "post",
                data: {
                  action: "getlogindata",
                  signimg: chkRet.signimg,
                  keycode: chkRet.keyid,
                  operhis: operhis,
                  computername: computername,
                },
              })
              .then((res) => {
                if (res.flag == 1) {
                  s({
                    flag: "1",
                    data: res,
                  })
                } else {
                  s({
                    flag: "-1",
                    msg: "CA登录失败：" + res.msg
                  })
                }
              }).catch(() => {
                s({
                  flag: "-1",
                  msg: "CA登录失败，根据CA查找人员信息时失败！"
                })
              });
          } else {
            s({
              flag: "-1",
              msg: "CA登录失败，未找到有效的CA！"
            })
          }
        }
      });
    },
    // 审核报告前
    BeforeCheckReport(thenaction, printtype, cahaslogin) {
      if (this.checkingflag) {
        if (!this.CheckingMsgObj) {
          this.CheckingMsgObj = this.$message({
            message: "上一报告正在审核中,请稍候...",
            type: "warning",
            duration: 0,
            showClose: true,
            onClose: () => {
              this.CheckingMsgObj = "";
            },
          });
        }
        return;
      }
      this.checkingflag = true;
      //this.$pub.Log("开始审核后台:" + this.PatientInfo.reportid);
      let rckuser = !this.PatientInfo.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernorhk : this.PatientInfo.rechk_user;
      if (this.Options.rechkcoverechkuser == "1") {
        rckuser = this.exactusernorhk;
      }
      if (this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0") {
        rckuser = this.PatientInfo.report_user ? this.PatientInfo.report_user : this.exactusernoreport;
      }
      //前面已经直接使用ca登录过了，这里就不要再来一次ca验证登录了
      if (cahaslogin && cahaslogin == "1") {
        if (this.Options.alertautocheckresult) {
          this.GetAutoCheckResult(thenaction, printtype);
          return;
        }
        this.CheckReportRe(0, thenaction, printtype);
      } else {
        this.checkCaLogin(rckuser).then((cares) => {
          console.log("cares", cares);
          if (cares.flag == "1") {
            console.log("check0", cares.flag);
            if (this.Options.alertautocheckresult) {
              this.GetAutoCheckResult(thenaction, printtype);
              return;
            }
            this.CheckReportRe(0, thenaction, printtype);
          } else {
            //this.CheckReportRe(0,thenaction, printtype);
            this.checkingflag = false;
            this.$alert("CA登录失败！" + cares.msg, "登陆失败", {
              confirmButtonText: "确定",
              type: "error",
            });
          }
        });
      }
    },
    //处理审核前的数据整理
    BeforCheckReportRe() {
      this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :开始审核" + this.PatientInfo.reportid + "\r\n";
      //this.$pub.Log("开始审核:" + this.PatientInfo.reportid);
      if (this.PRGNO == "LIS313") {
        this.$refs.rmlabresult.beforeSaveReport();
      }

      var result = this.$refs.rmlabresult.$refs.xTableResult.getRecordset();
      // 判断合并table
      if (this.Options.doubleresultcol == "1" && this.$refs.rmlabresult.$refs.xTableResult1) {
        var result1 = this.$refs.rmlabresult.$refs.xTableResult1.getRecordset();
        result.updateRecords = result.updateRecords.concat(result1.updateRecords);
        result.insertRecords = result.insertRecords.concat(result1.insertRecords);
        result.removeRecords = result.removeRecords.concat(result1.removeRecords);
      }
      if (this.PRGNO == "LIS313") {
        if (this.$refs.rmlabresult.$refs.xTableResult2) {
          var result2 = this.$refs.rmlabresult.$refs.xTableResult2.getRecordset();
          result.updateRecords = result.updateRecords.concat(result2.updateRecords);
          result.insertRecords = result.insertRecords.concat(result2.insertRecords);
          result.removeRecords = result.removeRecords.concat(result2.removeRecords);
        }
        this.PatientInfo.txtinfo1 = this.$refs.rmlabresult.txtinfo1;
        this.PatientInfo.txtinfo2 = this.$refs.rmlabresult.txtinfo2;
        for (let i = result.updateRecords.length - 1; i >= 0; i--) {
          if (result.updateRecords[i].cdata.reportid == "") {
            result.insertRecords.push(result.updateRecords[i].cdata);
            result.updateRecords.splice(i, 1);
          }
        }
      }
      else if (this.PRGNO == "LIS314") {
        this.PatientInfo.txtinfo1 = this.$refs.rmlabresult.txtinfo1;
        this.PatientInfo.txtinfo2 = this.$refs.rmlabresult.txtinfo2;
        this.PatientInfo.lab_advice = this.$refs.rmlabresult.lab_advice;
      }
      var meds = "";
      var sheet = "";
      if (this.PRGNO == "LIS311") {
        // if (this.$refs.rmlabresult.$refs.xTableResult.tableFullData && this.$refs.rmlabresult.$refs.xTableResult.tableFullData.length > 0) {
        //     var rptcode = this.$refs.rmlabresult.$refs.xTableResult.getCurrentRow().rpt_itemcode;
        //     var medData = this.$refs.rmlabresult.MedTotalData.filter(item => item.rpt_itemcode != rptcode);
        //     for (let i = 0; i < this.$refs.rmlabresult.$refs.xTableMed.tableFullData.length; i++) {
        //         medData.push(this.$refs.rmlabresult.$refs.xTableMed.tableFullData[i]);
        //     }
        //     meds = medData;
        // }
        this.$refs.rmlabresult.GetTotalMedData(this.PatientInfo.reportid);
        meds = this.$refs.rmlabresult.MedTotalData;
        if (this.$refs.rmlabresult.ShowSheet) {
          sheet = { sheetdate: this.$refs.rmlabresult.Sheetdate, sheetuser: this.$refs.rmlabresult.Sheetuser, receiveuser: this.$refs.rmlabresult.Recieveuser, medium: this.$refs.rmlabresult.Medium, condtions: this.$refs.rmlabresult.Conditions, smear: this.$refs.rmlabresult.Smear, dyeing: this.$refs.rmlabresult.Dyeing, colonyresult: this.$refs.rmlabresult.ColonyResult, colonynum: this.$refs.rmlabresult.ColonyNum, otherresult: this.$refs.rmlabresult.OtherResult };
        }
      } else if (this.PRGNO == "LIS313") {
        this.PatientInfo.txtinfo1 = this.$refs.rmlabresult.txtinfo1;
        this.PatientInfo.txtinfo2 = this.$refs.rmlabresult.txtinfo2;
        for (let i = result.updateRecords.length - 1; i >= 0; i--) {
          if (result.updateRecords[i].cdata.reportid == "") {
            result.insertRecords.push(result.updateRecords[i].cdata);
            result.updateRecords.splice(i, 1);
          }
        }
      }
      else if (this.PRGNO == "LIS314") {
        this.PatientInfo.txtinfo1 = this.$refs.rmlabresult.txtinfo1;
        this.PatientInfo.txtinfo2 = this.$refs.rmlabresult.txtinfo2;
        this.PatientInfo.lab_advice = this.$refs.rmlabresult.lab_advice;
      }

      var newflag = this.tableDataListS.filter((item) => item.sampleno == this.specno && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid).length == 0;
      this.PatientInfo.sampleno = this.specno + "";
      this.PatientInfo.sampledate = this.selectdate + "";
      this.PatientInfo.rptunitid = this.rptunitid + "";
      var imageinfo = [];
      if (this.ImageList.length > 0) {
        for (let i = 0; i < this.ImageList.length; i++) {
          imageinfo.push({ reportid: this.PatientInfo.reportid, graphitemno: this.ImageList[i].name, seq: this.ImageList[i].seq, extrainfo: this.ImageList[i].comm });
        }
      }
      // const loading = this.$loading({
      //     lock: true,
      //     text: "审核中",
      //     spinner: "el-icon-loading",
      //     background: "rgba(255, 255, 255, 0.7)"
      // });
      this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :开始审核后台" + this.PatientInfo.reportid + "\r\n";
      //this.$pub.Log("开始审核后台:" + this.PatientInfo.reportid);
      let rckuser = !this.PatientInfo.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernorhk : this.PatientInfo.rechk_user;
      let rckusername = !this.PatientInfo.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernamerhk : this.PatientInfo.rechk_username;
      let rptusr = this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0" ? this.exactusernoreport : this.PatientInfo.report_user ? this.PatientInfo.report_user : this.exactusernoreport;
      let rptusername = this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0" ? this.exactusernamereport : this.PatientInfo.report_username ? this.PatientInfo.report_username : this.exactusernamereport;
      if (this.Options.rechkcoverechkuser == "1") {
        rckuser = this.exactusernorhk;
        rckusername = this.exactusernamerhk;
      }
      if (this.Options.rechkcoverreportuser == "1") {
        rptusr = this.exactusernoreport;
        rptusername = this.exactusernamereport;
      }
      this.logcontent += "审核医生: " + rckuser + "\r\n";
      return { rckuser: rckuser, rptusr: rptusr, result: result, meds: meds, sheet: sheet, imageinfo: imageinfo, rckusername: rckusername, rptusername: rptusername, newflag: newflag };
    },
    //审核报告后台请求方法独立出来
    CheckReportRe(alertflag, thenaction, printtype) {
      var beforere = this.BeforCheckReportRe();
      var rptusr = beforere.rptusr;
      var rckuser = beforere.rckuser;
      var result = beforere.result;
      var meds = beforere.meds;
      var sheet = beforere.sheet;
      var imageinfo = beforere.imageinfo;
      var rckusername = beforere.rckusername;
      var rptusername = beforere.rptusername;
      var newflag = beforere.newflag;
      if (this.Options.rechkreportsyncmode == "1" && !newflag) {
        if (!this.synccheckvisible) {
          this.synccheckvisible = true;
          this.syncchecktxt = "";
          this.syncchecksuccess = 0;
          if (localStorage.getItem("floatwindowstyle5")) this.floatwindowstyle5 = localStorage.getItem("floatwindowstyle5");
        }
        if (this.syncreportid.indexOf(this.PatientInfo.reportid) == -1) {
          this.CheckReportReSync(alertflag, thenaction, printtype);
          return;
        }
      }
      this.checkingflag = true;

      if (alertflag) {
        if (this.similarflag == "2" && this.unsimilarreason == "") {
          this.$alert("请输入不符原因!", "提示");
          return;
        }
      }
      var issign = this.PatientInfo.rechkflag == "0" && this.Options.checkmustsignname == "1" ? "1" : "0";
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "checkreport",
            reportid: this.PatientInfo.reportid,
            reportuser: rptusr,
            checkuser: rckuser,
            rptinfo: this.PatientInfo,
            oldrptinfo: this.OldPatientInfo,
            results: result,
            meds: meds,
            sheet: sheet,
            imageinfo: imageinfo.length > 0 ? imageinfo : "",
            issign: issign,
            autochkflag: alertflag == "1" ? this.similarflag : "",
            autochkmsg: alertflag == "1" ? this.unsimilarreason : "",
            syncmode: this.Options.rechkreportsyncmode,
          },
        })
        .then((res) => {
          if (!this.PatientInfo.reportid) {
            this.PatientInfo.reportid = res.reporttoca.reportid;
          }
          var rptinfo = XE.clone(this.PatientInfo, true);
          this.addOperList = [];
          this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核后台查询结束" + this.PatientInfo.reportid + "\r\n";
          //this.$pub.Log("审核后台查询结束:" + this.PatientInfo.reportid);
          // 不管返回结果是什么，自动审核弹窗都要消失
          if (this.dialogAutochkVisible) this.dialogAutochkVisible = false;
          if (res.flag == 1 || res.flag == 2) {
            if (res.alertflag == 1) {
              this.DangerAllflag = false;
              this.dangerreportid = this.PatientInfo.reportid;
              this.dialogDangerVisible = true;
              this.CurrentCheckUser = { userno: rckuser, username: rckusername };
              this.CurrentReportUser = { userno: rptusr, username: rptusername };
              this.checkingflag = false;
              this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核危急值弹窗: " + this.PatientInfo.reportid + "\r\n";
              this.$pub.Log(this.logcontent);
              this.logcontent = "";
              // loading.close();
            } else {
              this.$nextTick(() => {
                this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :开始checkthen方法:" + this.PatientInfo.reportid + "\r\n";
                if (this.synccheckvisible) this.syncchecksuccess++;
                //this.$pub.Log("开始checkthen方法:" + this.PatientInfo.reportid);
                this.CheckThen(res, "1", rckuser).then(() => {
                  this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :checkthen方法结束: " + this.PatientInfo.reportid + "\r\n";
                  this.$pub.Log(this.logcontent);
                  this.logcontent = "";
                  //this.$pub.Log("checkthen方法结束:" + this.PatientInfo.reportid);
                  if (thenaction || res.isprint)
                    //签名不走这
                    this.PrintFunc(1)
                      .then(() => {
                        //打印或者审核完自动下一标本
                        if (this.Options.autonextaftercheck > 0 || this.Options.autonextafterprint > 0) {
                          this.checkingflag = false;
                          if (this.Options.autonextmodeaftercheck == "1") this.SpecChangeActionList(1);
                          else this.SpecChangeAction(1, 0);
                        } else {
                          if (res.r == "1") {
                            this.checkingflag = false;
                            this.$refs.rmlabresult.QueryResult(this.PatientInfo).then((res) => {
                              if (!res.hasOwnProperty("res")) {
                                res.res = res;
                                res.redo = "";
                                res.history = 0;
                              }
                              this.Patredoflag = !!res.redo;
                              this.PatHistoryNum = res.history;
                              if (this.PRGNO == "LIS311") {
                                if (res.iscontainBacteria) {
                                  this.showPatHistoryNum = res.history;
                                } else {
                                  this.showPatHistoryNum = 0;
                                }
                              } else {
                                this.showPatHistoryNum = res.history;
                              }
                              var row = XE.clone(res.res, true);
                              this.PatientInfo = this.PatientInfoGetname(row);
                              this.OldPatientInfo = this.PatientInfoGetname(row);
                              this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
                              this.specno = res.sampleno ? res.sampleno : this.specno;
                              if (this.prgno == "LIS311") this.$refs.rmlabresult.QueryMed();
                            });
                          } else {
                            this.checkingflag = false;
                          }
                        }
                      })
                      .catch(() => {
                        this.checkingflag = false;
                      });
                  //同时设置了审核后自动下一个，和审核后自动打印的情况下，这里应该有问题
                  else {
                    this.$nextTick(() => {
                      // console.log(this.Options.autonextaftercheck);
                      //开启签名并且当前操作是签名的时候，判断签名完成自动下一标本是否开启，其他的情况判断审核完成自动下一标本是否开启
                      if ((issign == "1" && this.Options.autonextaftersign > 0) || (issign != "1" && this.Options.autonextaftercheck > 0)) {
                        this.checkingflag = false;
                        if (this.Options.autonextmodeaftercheck == "1") this.SpecChangeActionList(1);
                        else this.SpecChangeAction(1, 0);
                      } else {
                        if (res.r == "1") {
                          this.$refs.rmlabresult.QueryResult(this.PatientInfo).then((res) => {
                            this.checkingflag = false;
                            if (!res.hasOwnProperty("res")) {
                              res.res = res;
                              res.redo = "";
                              res.history = 0;
                            }
                            this.Patredoflag = !!res.redo;
                            this.PatHistoryNum = res.history;
                            if (this.PRGNO == "LIS311") {
                              if (res.iscontainBacteria) {
                                this.showPatHistoryNum = res.history;
                              } else {
                                this.showPatHistoryNum = 0;
                              }
                            } else {
                              this.showPatHistoryNum = res.history;
                            }
                            var row = XE.clone(res.res, true);
                            this.PatientInfo = this.PatientInfoGetname(row);
                            this.OldPatientInfo = this.PatientInfoGetname(row);
                            this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
                            this.specno = res.sampleno ? res.sampleno : this.specno;
                            if (this.prgno == "LIS311") this.$refs.rmlabresult.QueryMed();
                          });
                        } else {
                          this.checkingflag = false;
                        }
                      }
                    });
                  }
                });

                // loading.close();
              });
            }
          } else {
            // loading.close();
            this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核失败: " + this.PatientInfo.reportid + "\r\n";
            this.$pub.Log(this.logcontent);
            this.logcontent = "";

            let addsql = [];
            if (res.sqlList) {
              for (let i = 0; i < res.sqlList.length; i++) {
                this.addOperList.push(res.sqlList[i].Item1);
                addsql.push(res.sqlList[i].Item1);
              }
            }
            //this.addOperList = res.sqlList;
            this.ErrorListDeal(res.msg, res.flag, res.alertflag)
              .then(() => {
                if (res.alertflag == "1") {
                  this.DangerAllflag = false;
                  this.dangerreportid = rptinfo.reportid;
                  this.dialogDangerVisible = true;
                  this.CurrentCheckUser = { userno: rckuser, username: rckusername };
                  this.CurrentReportUser = { userno: rptusr, username: rptusername };
                } else {
                  this.CheckReportRequest("", "", rptinfo, addsql);
                }
                this.checkingflag = false;
              })
              .catch(() => {
                if (res.r == "1") {
                  let addresult = res.addresult;
                  this.$refs.rmlabresult.QueryResult(this.PatientInfo).then((res) => {
                    if (!res.hasOwnProperty("res")) {
                      res.res = res;
                      res.redo = "";
                      res.history = 0;
                    }
                    if (addresult) {
                      if (addresult.length > 0) {
                        for (let i = 0; i < addresult.length; i++) {
                          if (this.$refs.rmlabresult.$refs.xTableResult.tableFullData.filter((item) => item.rpt_itemcode == addresult[i].rpt_itemcode).length == 0) {
                            this.$refs.rmlabresult.$refs.xTableResult.insertAt(addresult[i], -1);
                          }
                        }
                      }
                    }
                    this.Patredoflag = !!res.redo;
                    this.PatHistoryNum = res.history;
                    if (this.PRGNO == "LIS311") {
                      if (res.iscontainBacteria) {
                        this.showPatHistoryNum = res.history;
                      } else {
                        this.showPatHistoryNum = 0;
                      }
                    } else {
                      this.showPatHistoryNum = res.history;
                    }
                    var row = XE.clone(res.res, true);
                    this.PatientInfo = this.PatientInfoGetname(row);
                    this.OldPatientInfo = this.PatientInfoGetname(row);
                    this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
                    this.specno = res.sampleno ? res.sampleno : this.specno;
                    if (this.prgno == "LIS311") this.$refs.rmlabresult.QueryMed();
                  });
                }
                this.checkingflag = false;
              });
          }
        })
        .catch((error) => {
          // loading.close();
          this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核失败: " + this.PatientInfo.reportid + "\r\n";
          this.$pub.Log(this.logcontent);
          this.logcontent = "";
          this.checkingflag = false;
          this.$message.error("错误:" + error);
        });
    },
    // 异步审核
    CheckReportReSync(alertflag, thenaction, printtype) {
      // if (this.Options.rechkreportsyncmode == "1") {
      //     if(!this.synccheckvisible) {
      //         if (localStorage.getItem("floatwindowstyle5")) this.floatwindowstyle5 = localStorage.getItem("floatwindowstyle5");
      //         this.synccheckvisible = true;
      //     }

      //     this.checkingflag = false;
      //     if (this.Options.autonextaftercheck == "1") this.SpecChangeActionList(1);
      // }
      var beforere = this.BeforCheckReportRe();
      var rptusr = beforere.rptusr;
      var rckuser = beforere.rckuser;
      var result = beforere.result;
      var meds = beforere.meds;
      var sheet = beforere.sheet;
      var imageinfo = beforere.imageinfo;
      var rckusername = beforere.rckusername;
      var newflag = beforere.newflag;
      if (alertflag) {
        if (this.similarflag == "2" && this.unsimilarreason == "") {
          this.$alert("请输入不符原因!", "提示");
          return;
        }
      }
      this.SpecChangeActionList(1);
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "checkreport",
            reportid: this.PatientInfo.reportid,
            reportuser: rptusr,
            checkuser: rckuser,
            rptinfo: this.PatientInfo,
            oldrptinfo: this.OldPatientInfo,
            results: result,
            meds: meds,
            sheet: sheet,
            imageinfo: imageinfo.length > 0 ? imageinfo : "",
            issign: this.PatientInfo.rechkflag == "0" && this.Options.checkmustsignname == "1" ? "1" : "0",
            autochkflag: alertflag == "1" ? this.similarflag : "",
            autochkmsg: alertflag == "1" ? this.unsimilarreason : "",
            syncmode: this.Options.rechkreportsyncmode,
          },
        })
        .then((res) => {
          if (res.flag == 1 || res.flag == 2) {
            if (res.alertflag == 1) {
              this.syncchecktxt += "报告" + res.reportid + "存在危急值\r\n";
              if (this.syncreportid.indexOf(res.reportid) == -1) this.syncreportid.push(res.reportid);
            } else {
              this.syncchecksuccess++;
              this.SyncCheckThen(res);
            }
          } else {
            var msg = "";
            if (res.flag == -1 && res.msg.errorMsg) msg = res.msg.errorMsg[0];
            else if (res.flag == -2 && res.msg.confirmDefNoMsg) msg = res.msg.confirmDefNoMsg[0];
            else if (res.flag == -3 && res.msg.confirmDefYesMsg) msg = res.msg.confirmDefYesMsg[0];
            else if (res.flag == 4 && res.msg.inputMsg) msg = res.msg.inputMsg[0];
            if (this.syncreportid.indexOf(res.reportid) == -1) this.syncreportid.push(res.reportid);
            this.syncchecktxt += "报告" + res.reportid + "审核出错: " + (msg ? msg.content : "") + "\r\n";
          }
        });
    },
    // 异步审核后续
    SyncCheckThen(res) {
      var checkrow = this.$refs.xTableList.afterFullData.find((item) => item.reportid == res.reportid);
      if (!checkrow) {
        var infoarr = res.reportid.split("-");
        checkrow = this.$refs.xTableList.afterFullData.find((item) => item.sampledate == infoarr[0] && item.sampleno == infoarr[2] && item.rptunitid == infoarr[1]);
      }
      if (checkrow) {
        checkrow.rechk_dt = res.rechk_dt;
        checkrow.rechkflag = "9";
        checkrow.rechk_user = checkrow.rechk_user ? checkrow.rechk_user : this.exactusernorhk;
        checkrow.rechk_username = checkrow.rechk_username ? checkrow.rechk_username : this.exactusernamerhk;
        this.$ca.CaSignSync(checkrow.rechk_user ? checkrow.rechk_user : this.exactusernorhk, res.reporttoca.data, res.reporttoca.reportid);
      }
    },
    // 异步审核保存CA
    SyncCheckSaveCa(signjson, reportid, userno) {
      var cadata = JSON.parse(signjson);
      if (cadata.code == "1") {
        this.$tool
          .request({
            url: "/ucent/ca",
            method: "post",
            data: {
              action: "savecasign",
              signdatas: signjson.signdatas,
              signid: signjson.signid,
              reportid: reportid,
              rechkuser: userno,
              keyid: signjson.keyid,
            },
          })
          .then((sret) => {
            if (sret.flag == 1) {
            } else {
              this.syncchecktxt += "报告" + reportid + "CA签名出错\r\n";
            }
          })
          .catch(() => { });
      } else {
        this.syncchecktxt += "报告" + reportid + "CA签名出错\r\n";
      }
    },
    // 审核CA登录
    checkCaLogin(rckuser) {
      return new Promise((s, f) => {
        if (this.Options.useca == "1") {
          this.$ca.checklogin("rptchk", rckuser).then((cares) => {
            s(cares);
          });
        } else {
          s({ flag: "1" });
        }
      });
    },
    // 审核报告确认提交
    CheckReportRequest(alertreportflag, alertinfo, row, addsql) {
      return new Promise((s, f) => {
        // const loading = this.$loading({
        //     lock: true,
        //     text: "审核中",
        //     spinner: "el-icon-loading",
        //     background: "rgba(255, 255, 255, 0.7)"
        // });
        var beforere = this.BeforCheckReportRe();
        var rptusr = beforere.rptusr;
        var rckuser = beforere.rckuser;
        var rckusername = beforere.rckusername;

        console.log("request", row);
        this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核exec开始: " + row.reportid + "\r\n";

        // let rckuser = !row.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernorhk : row.rechk_user;
        // let rckusername = !row.rechk_username || this.specinuseflaginrecord == "2" ? this.exactusernamerhk : row.rechk_username;
        // if (this.Options.rechkcoverechkuser == "1") {
        //     rckuser = this.exactusernorhk;
        //     rckusername = this.exactusernamerhk;
        // }
        // let rptusr = row.report_user ? row.report_user : this.exactusernoreport;
        // if (this.Options.rechkcoverreportuser == "1") {
        //     rptusr = this.exactusernoreport;
        // }
        var issign = row.rechkflag == "0" && this.Options.checkmustsignname == "1" ? "1" : "0";
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            data: {
              action: "execcheckreport",
              reportid: row.reportid,
              reportuser: rptusr,
              checkuser: rckuser, //this.PatientInfo.rechk_user ? this.PatientInfo.rechk_user : this.exactusernorhk,
              inputmsg: this.InputMsg,
              alertreportflag: alertreportflag,
              alertinfo: alertinfo,
              issign: issign,
              sqlList: addsql,//this.addOperList 不直接使用全局变量，异步过程中可能会被改变
            },
          })
          .then((res) => {
            this.DangerAllflag = false; //单独上报危急值标志置为false
            this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核exec查询后台结束: " + this.PatientInfo.reportid + "\r\n";
            if (res.flag == "1") {
              // loading.close();
              if (this.dialogDangerVisible) {
                this.dialogDangerVisible = false;
                var dangerrow = this.$refs.xTableList.getCurrentRow();
                if (this.Begincheckmode) {
                  dangerrow = this.CheckRows[this.checkindex];
                  this.checkindex++;
                  this.checksuccess++;
                  if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
                  else this.AlertMsg();
                }
                dangerrow.rechk_user = rckusername;
                dangerrow.rechk_dt = this.selectdate;
                if (this.Begincheckmode && this.batsignmode == "1") {
                  dangerrow.cp_msg = "签名成功";
                  dangerrow.rechkflag = "1";
                } else {
                  dangerrow.cp_msg = "审核成功";
                  dangerrow.rechkflag = "9";
                }
              }
              if (this.dialogAutochkVisible) this.dialogAutochkVisible = false;
              this.$nextTick(() => {
                this.CheckThen(res, "2", rckuser).then(() => {
                  this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核exec结束且不刷新数据: " + row.reportid + "\r\n";
                  this.$pub.Log(this.logcontent);
                  this.logcontent = "";
                  if (res.isprint) this.CheckPrint(1);
                  this.$nextTick(() => {
                    if ((issign == "1" && this.Options.autonextaftersign > 0) || (issign != "1" && this.Options.autonextaftercheck > 0)) {
                      if (this.Options.autonextmodeaftercheck == "1") this.SpecChangeActionList(1);
                      else this.SpecChangeAction(1, 0);
                    } else {
                      //移动到这是防止跳到下一个了，你这又给我跳回来算怎么个事
                      if (this.Options.reservenullresult == "2")//审核前自动删除空结果
                      {
                        this.$refs.rmlabresult.QueryResult(this.PatientInfo);//如果有空的结果，删除完了需要刷新结果
                      }
                    }
                  });
                });
              });

              s();
            } else {
              // loading.close();
              this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核exec结束且出错: " + row.reportid + "\r\n";
              this.$pub.Log(this.logcontent);
              this.logcontent = "";
              this.$refs.rmlabresult.QueryResult(this.PatientInfo).then((res) => {
                this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :审核结束且查询数据结束: " + row.reportid + "\r\n";
                this.$pub.Log(this.logcontent);
                this.logcontent = "";
                if (!res.hasOwnProperty("res")) {
                  res.res = res;
                  res.redo = "";
                  res.history = 0;
                }
                this.Patredoflag = !!res.redo;
                this.PatHistoryNum = res.history;
                if (this.PRGNO == "LIS311") {
                  if (res.iscontainBacteria) {
                    this.showPatHistoryNum = res.history;
                  } else {
                    this.showPatHistoryNum = 0;
                  }
                } else {
                  this.showPatHistoryNum = res.history;
                }
                var row = XE.clone(res.res, true);
                this.PatientInfo = this.PatientInfoGetname(row);
                this.OldPatientInfo = this.PatientInfoGetname(row);
                this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
                this.specno = res.sampleno ? res.sampleno : this.specno;
                if (this.prgno == "LIS311") this.$refs.rmlabresult.QueryMed();
              });
              this.ErrorListDeal(res.msg, res.flag)
                .then(() => {
                  f();
                })
                .catch(() => {
                  f();
                });
            }
          })
          .catch((error) => {
            this.DangerAllflag = false; //单独上报危急值标志置为false
            this.$message.error("错误:" + error);
            f();
          });
      });
    },
    // 自动审核结论查询
    GetAutoCheckResult(thenaction, printtype) {
      this.checkingflag = false;
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "getautocheckresult",
            reportid: this.PatientInfo.reportid,
            rptunitid: this.rptunitid,
          },
        })
        .then((res) => {
          if (!res.hasOwnProperty("errcode") && res.alertflag) {
            if (res.chkflag == "1") {
              this.AutoCheckResult = "通过";
              this.AutoCheckResultReason = [];
              if (this.Options.alertautocheckresult == "1") this.CheckReportRe(0, thenaction, printtype);
              else {
                this.similarflag = 1;
                this.unsimilarreason = "";
                this.dialogAutochkVisible = true;
              }
            } else {
              this.AutoCheckResult = "不通过";
              if (res.chkresult != "") {
                var arr = res.chkresult.split(";");
                this.AutoCheckResultReason = [];
                for (let i = 0; i < arr.length; i++) {
                  if (arr[i]) this.AutoCheckResultReason.push(arr[i]);
                }
              } else this.AutoCheckResultReason = [];
              this.similarflag = 1;
              this.unsimilarreason = "";
              this.dialogAutochkVisible = true;
            }
          } else {
            // this.AutoCheckResult = "不通过";
            // this.AutoCheckResultReason = ["1.对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对对","2.不对"];
            // this.dialogAutochkVisible = true;
            this.CheckReportRe(0, thenaction, printtype);
          }
        });
    },
    // 打印功能
    PrintFunc(type, reportid) {
      return new Promise((s, f) => {
        const loading = this.$loading({
          lock: true,
          text: "打印中",
          spinner: "el-icon-loading",
          background: "rgba(0, 0, 0, 0.7)",
        });
        // xuanxiang
        if (this.Options.useca == '1' && this.Options.checksignbeforeprint == '1') {

          this.$tool
            .request({
              url: "LIS/LIS3/LIS310",
              method: "post",
              data: {
                action: "printreport",
                reportid: reportid ? reportid : this.PatientInfo.reportid,
                userno: this.$tool.getSession(this.$tool.loginuserno),
                printorview: type,
              },
            })
            .then((res) => {
              if (res.Item1 == 1) {
                this.$pub
                  .printreport(this, this.PatientInfo.reportid, type, "", "1", "1", 99)
                  .then(() => {
                    if (type == 1) {
                      this.PatientInfo.printflag = 1;
                      this.OldPatientInfo.printflag = 1;
                      this.$refs.xTableList.tableFullData[this.tempRowIndex].printflag = 1;
                    }
                    loading.close();
                    s();
                  })
                  .catch(() => {
                    loading.close();
                    f();
                  });
                //暂时先屏蔽这个功能吧
                // if (type == "1") {
                //     if (this.Options.autonextafterprint > 0) this.SpecChangeActionList(1);
                // }
              } else {
                loading.close();
                this.ErrorListDeal(res.Item2, res.Item1)
                  .then(() => {
                    f();
                  })
                  .catch(() => {
                    f();
                  });
              }
            })
            .catch(() => {
              loading.close();
            });

        }
        else {
          this.$tool
            .request({
              url: "LIS/LIS3/LIS310",
              method: "post",
              data: {
                action: "printreport",
                reportid: reportid ? reportid : this.PatientInfo.reportid,
                userno: this.$tool.getSession(this.$tool.loginuserno),
                printorview: type,
              },
            })
            .then((res) => {
              if (res.Item1 == 1) {
                this.$pub
                  .printreport(this, this.PatientInfo.reportid, type, "", "1", "1")
                  .then(() => {
                    if (type == 1) {
                      this.PatientInfo.printflag = 1;
                      this.OldPatientInfo.printflag = 1;
                      this.$refs.xTableList.tableFullData[this.tempRowIndex].printflag = 1;
                    }
                    loading.close();
                    s();
                  })
                  .catch(() => {
                    loading.close();
                    f();
                  });
                //暂时先屏蔽这个功能吧
                // if (type == "1") {
                //     if (this.Options.autonextafterprint > 0) this.SpecChangeActionList(1);
                // }
              } else {
                loading.close();
                this.ErrorListDeal(res.Item2, res.Item1)
                  .then(() => {
                    f();
                  })
                  .catch(() => {
                    f();
                  });
              }
            })
            .catch(() => {
              loading.close();
            });
        }
      });
    },
    // #endregion 审核相关

    // #region 解除审核相关
    // 解除审核后续
    UnCheckThen(res, type) {
      this.PatientInfo.rechk_dt = "";
      this.PatientInfo.rechk_user = "";
      this.PatientInfo.rechk_username = "";
      this.OldPatientInfo.rechk_dt = "";
      this.OldPatientInfo.rechk_user = "";
      this.OldPatientInfo.rechk_username = "";
      this.$emit("haschange", false);
      if (this.Options.unchekreportsignstat == "1" && this.PatientInfo.rechkflag == "9") {
        this.PatientInfo.rechkflag = "1";
        this.OldPatientInfo.rechkflag = "1";
        this.imgUrl = require("@/assets/img/signed.png");
      } else {
        this.PatientInfo.rechkflag = "0";
        this.OldPatientInfo.rechkflag = "0";
        this.imgUrl = "";
      }
      this.PatientInfo.autocheckflag = "";
      this.OldPatientInfo.autocheckflag = "";
      if (this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0") {
        this.$emit("title", "签名");
        this.chktitleflag = true;
      }
      this.$refs.rmlabresult.editflag = true;
      if (this.Options.unchekreportsignstat == "1" && this.Options.canupdateaftersign != "1") this.$refs.rmlabresult.editflag = false;
      var row = this.$refs.xTableList.tableFullData.find((item) => item.sampleno == this.specno && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid);
      row.rechk_dt = "";
      row.rechkflag = this.PatientInfo.rechkflag;
      // 解除审核后应为待审核
      row.prechkflag = "1";
      row.rechk_user = "";
      row.rechk_username = "";
      row.autocheckflag = "";
      this.$nextTick(() => {
        this.$refs.xTableList.setCurrentRow(row);
        if (this.dialogMixDelVisible) this.dialogMixDelVisible = false;
        this.CalcNum(this.$refs.xTableList.tableFullData);
      });

      if (res.msg && res.msg.hasOwnProperty("showMsg") && res.msg.showMsg.length > 0) {
        this.ErrorListDeal(res.msg, "2");
      }

      // this.TotalPatNum = this.$refs.xTableList.tableFullData.length;
      // this.ExactNum = this.$refs.xTableList.tableFullData.filter((item) => item.rechkflag > 0).length;
      // this.UnExactNum = this.$refs.xTableList.tableFullData.filter((item) => item.rechkflag == 0).length;
    },
    // 解除审核
    UnCheckReport(userno) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "uncheckreport",
            reportid: this.PatientInfo.reportid,
            userno: userno,
          },
        })
        .then((res) => {
          if (res.flag == 1) {
            if (res.otherflag == 1) {
              this.UnCheckReportOtherOper(userno);
              this.UnCheckThen(res);
            } else if (res.otherflag == 2) {
              if (!this.dialogMixDelVisible) {
                this.tableDataMixbarcode = res.mixreport;
                this.dialogMixDelVisible = true;
              }
            } else {
              this.UnCheckThen(res);
            }
          } else {
            //=-1 错误消息的时候会进 catch
            this.ErrorListDeal(res.msg, res.flag)
              .then(() => {
                if (res.otherflag == 1) {
                  this.UnCheckReportOtherOper(userno);
                } else {
                  this.UnCheckReportExec(userno);
                }
              })
              .catch(() => {
                // console.log("ErrorListDeal catch");
              });
          }

          // else if (res.Item1 != -1) {
          //     this.ErrorListDeal(res.Item3, res.Item1, 0, "uncheck");
          // } else {
          //     this.ErrorListDeal(res.Item3, res.Item1);
          // }
        })
        .catch(() => { });
      this.loginsucessedflag = false;
    },
    // 解除审核其他操作
    UnCheckReportOtherOper(userno, row) {
      var reportid = this.PatientInfo.reportid;
      if (row) reportid = row.reportid;
      if (!userno) userno = this.$tool.getSession(this.$tool.loginuserno);
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "uncheckreportotheroper",
            reportid: reportid,
            userno: userno,
          },
        })
        .then((res) => {
          if (res.flag == 1) {
            if (row) {
              row.cp_msg = "解除成功";
              row.rechkflag = "0";
              if (++this.MixIndex < this.MixDatas.length) {
                this.UnCheckReportMix(this.MixDatas[this.MixIndex]);
              } else {
                this.loginsucessedflag = true;
                this.BeforeUnCheckReport(this.$tool.getSession(this.$tool.loginuserno));
              }
            } else {
              this.UnCheckThen(res);
            }
          } else {
            this.ErrorListDeal(res.msg, res.flag);
          }
        });
    },
    // 确认解除审核
    UnCheckReportExec(userno) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "execuncheckreport",
            reportid: this.PatientInfo.reportid,
            userno: userno,
            inputmsg: this.InputMsg,
          },
        })
        .then((res) => {
          if (res.flag == "1") {
            this.UnCheckThen(res);
          } else {
            this.ErrorListDeal(res.msg, res.flag);
          }
        })
        .catch(() => { });
    },
    // #endregion 解除审核相关

    // #region 结果相关
    // 轮巡5秒重新刷结果
    RResult(loadpath, that) {
      if (that.$route.fullPath != loadpath) {
        // console.log("空转");
        if (that.RResultRunning) {
          setTimeout(() => {
            that.RResult(loadpath, that);
          }, 5000);
        }
      } else {
        this.RefreshResult(that, loadpath).finally((e) => {
          if (that.RResultRunning) {
            setTimeout(() => {
              that.RResult(loadpath, that);
            }, 5000);
          }
        });
      }
    },
    // 刷新结果
    async RefreshResult(vm, loadpath) {
      if (vm.Refreshflag && vm.$refs.rmlabresult && !vm.$refs.rmlabresult.Refreshflag && vm.PRGNO != "LIS313" && vm.PRGNO != "LIS312" && vm.PRGNO != "LIS314") {
        if (!vm.btndisabled) {


          var datas = vm.$refs.rmlabresult.$refs.xTableResult.getRecordset();
          if (vm.$refs.rmlabresult.Options.doubleresultcol == 1 && vm.$refs.rmlabresult.$refs.xTableResult1) {
            var result1 = vm.$refs.rmlabresult.$refs.xTableResult1.getRecordset();
            datas.updateRecords = datas.updateRecords.concat(result1.updateRecords);
            datas.insertRecords = datas.insertRecords.concat(result1.insertRecords);
            datas.removeRecords = datas.removeRecords.concat(result1.removeRecords);
          }
          if (datas.insertRecords.length == 0 && datas.removeRecords.length == 0 && datas.updateRecords.length == 0) {
            let reportid = vm.PatientInfo.reportid;
            if (reportid && vm.Refreshflag) {
              var rcntre = await vm.$tool.request({ url: "LIS/LIS3/LIS310", method: "post", data: { action: "queryresultcnt", reportid: reportid } });
              var rcnt = rcntre.cnt;
              vm.sysdate = rcntre.date;
              //如果后台返回的时间和24点时间差在5秒范围内，就提示切换日期
              if (rcntre.alertreplacedateflag) vm.NextDayAlert();

              if (rcnt > 0) {
                if (reportid == vm.PatientInfo.reportid && vm.Refreshflag && !vm.$refs.rmlabresult.Refreshflag) {
                  let resultlength = 0;
                  let resultstrlength = 0;
                  if (vm.$refs.rmlabresult.Options.doubleresultcol == 1) {//双列显示
                    resultlength = vm.$refs.rmlabresult.tableDataResult.length + vm.$refs.rmlabresult.tableDataResult1.length;
                    resultstrlength = vm.$refs.rmlabresult.tableDataResult.filter((t) => t.result_str && t.result_str != "" && t.result_str != "未做").length + vm.$refs.rmlabresult.tableDataResult1.filter((t) => t.result_str && t.result_str != "" && t.result_str != "未做").length;
                  } else {
                    resultlength = vm.$refs.rmlabresult.tableDataResult.length;
                    resultstrlength = vm.$refs.rmlabresult.tableDataResult.filter((t) => t.result_str && t.result_str != "" && t.result_str != "未做").length;
                  }
                  if (resultlength < rcnt || resultstrlength < rcnt) {
                    var results = await vm.$tool.request({ url: "LIS/LIS3/LIS310", method: "post", data: { action: "queryresultlist", sampledate: vm.selectdate, rptunitid: vm.rptunitid, sampleno: vm.specno, checkmode: vm.Begincheckmode ? "1" : "0" } });
                    if (results && reportid == vm.PatientInfo.reportid && vm.Refreshflag && !vm.$refs.rmlabresult.Refreshflag) {
                      // 拆分table
                      if (results.vxtab.Data.length > 0 && vm.PRGNO == "LIS310") {
                        vm.$refs.rmlabresult.dealCompResultstr(results.vxtab.Data);
                      }
                      if (vm.$refs.rmlabresult.Options.doubleresultcol == 1) {
                        vm.$refs.rmlabresult.tableDataResult = [];
                        vm.$refs.rmlabresult.tableDataResult1 = [];
                        var cnt = vm.$refs.rmlabresult.Options.doubleresultrows;

                        for (let index = 0; index < results.vxtab.Data.length; index++) {
                          const element = results.vxtab.Data[index];
                          if (index < cnt) {
                            vm.$refs.rmlabresult.tableDataResult.push(element);
                          }
                          else {
                            vm.$refs.rmlabresult.tableDataResult1.push(element);
                          }
                        }
                      }
                      else {
                        vm.$refs.rmlabresult.tableDataResult = results.vxtab.Data;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    // #endregion 结果相关

    // #region 页面相关

    // #region 整体

    // 页面滚动
    handleScroll(e) {
      if (window.event.ctrlKey) {
        if (e.target) {
          let i = 0;
          let obj = e.target.offsetParent;
          let r = -e.deltaY;
          while (obj && i < 100) {
            i++;
            if (obj.id == "leftMainDiv" || obj.firstElementChild.id == "leftMainDiv") {
              this.leftZoom = this.leftZoom * (1 + r / 1000);
              break;
            } else if (obj.id == "centerMainDiv" || obj.firstElementChild.id == "centerMainDiv") {
              this.centerZoom = this.centerZoom * (1 + r / 1000);
              break;
            } else if (obj.id == "rightMainDiv" || obj.firstElementChild.id == "rightMainDiv") {
              this.rightZoom = this.rightZoom * (1 + r / 1000);
              break;
            }
            obj = obj.offsetParent;
          }
        }
      }
    },
    // 初始化页面数据
    InitPageData() {
      var fixwidth = localStorage.getItem("RM_LAB_REPORT_FIXWIDTH");
      this.fixright = fixwidth ? fixwidth - 0 : 600;
      this.InitButton();
      if (localStorage.getItem("floatwindowstyle4")) this.floatwindowstyle4 = localStorage.getItem("floatwindowstyle4");
      if (localStorage.getItem("RM_LAB_REPORT_BUTTONFLOAT")) {
        var floatbutton = localStorage.getItem("RM_LAB_REPORT_BUTTONFLOAT");
        this.dialogbuttonfloatwindowVisible = floatbutton == "1";
      }
      if (localStorage.getItem("RM_LAB_REPORT_BUTTONFLOAT_SHOWMODE")) {
        var floatbuttonshowmode = localStorage.getItem("RM_LAB_REPORT_BUTTONFLOAT_SHOWMODE");
        this.ButtonListflag = floatbuttonshowmode == "1";
      }

      this.exactusernamereport = this.$tool.getSession(this.$tool.loginusername);
      this.exactusernoreport = this.$tool.getSession(this.$tool.loginuserno);
      //获取可从标本编号输入的报告单元
      this.GetSpecnoInputRptunit();
      //this.RegKeyEvent();
      this.pagepath = this.$route.fullPath;
      var pageinfo = this.$tool.getSession("RptPageInfo");
      var getrow = this.$tool.getSession("RptTo");
      if (getrow != null && getrow != "") getrow = JSON.parse(getrow);
      else getrow = { AddBy410: "0" };
      var addby = getrow.AddBy410;
      if ((pageinfo && pageinfo != "[]") || addby == "1") {
        var pagearr = JSON.parse(pageinfo);
        if ((pagearr && pagearr.length > 0) || addby == "1") {
          var pageindex = -1;
          if (addby == "0") pageindex = pagearr.findIndex((item) => item.path == this.$route.fullPath);
          if (pageindex < 0 && addby == "0") {
            // this.pageid = this.$route.query.id;
            this.dialogUnitVisible = true;
            this.$nextTick(() => {
              this.$refs.pop.setCurrentValue(0);
            });
          } else {
            this.pageinitloading = true;
            if (addby == "1") this.rptunitid = getrow.rptunitid;
            else this.rptunitid = pagearr[pageindex].rptunitid - 0;
            var multiflag = "";
            //if (pageindex > 0) multiflag = "1";
            this.GetOptions(this.rptunitid, multiflag)
              .then(() => {
                this.pageinitloading = false;
                if (this.sysdate == "") {
                  this.sysdate = this.Options.sysdate;
                  this.selectdate = this.sysdate + " 00:00:00";
                } else {
                  this.selectdate = this.sysdate + " 00:00:00";
                }
                if (addby == "1") this.selectdate = getrow.sampledate;
                this.QueryCol().then(() => {
                  this.QueryList(1).then(() => {
                    if (addby == "1") this.specno = getrow.sampleno;
                    this.SpecNoChange();
                    // 如果有下一个要打开的
                    if (pagearr && pagearr.length > 0) {
                      if (pageindex < pagearr.length && pageindex != -1) {
                        var page = pagearr[pageindex + 1];
                        if (page) {
                          this.$router.push({ path: pagearr[pageindex + 1].path });
                        }
                      }
                    }
                  });
                });
              })
              .catch(() => {
                this.$pub.Log("未获取到报告单元对应选项!");
                this.pageinitloading = false;
              });
            getrow.AddBy410 = "0";
            this.$tool.setSession("RptTo", JSON.stringify(getrow));
          }
          return;
        }
      }
      this.GetDefRptUnit();
    },
    excInit() {
      this.InitPageData();
    },
    btnTakePhoto() {
      if (typeof jsObj != "undefined") {
        //jsObj.AsyncCall("入参");  js这边就这样调用
        var s = jsObj.AsyncCall("callexe:ImageCatch.exe");
      } else {
        this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
          confirmButtonText: "确定",
        });
      }
    },
    rej_imagecatch(imgbase64) {
      console.log("saveimage");
      var imagedata = "data:image/png;base64," + imgbase64;
      var imageS = imagedata + "$image_split$";
      this.reqrejectimage += imageS;
      this.LPicData.push(imagedata);
      this.$message.success("已拍摄完成！");
    },
    deletepic(img) {
      if (!!img) {
        var index = this.LPicData.findIndex((m) => m == img);
        //删除
        this.LPicData.splice(index, 1);
        this.reqrejectimage = '';
        for (var i = 0; i < this.LPicData.length; i++) {
          let itemImg = this.LPicData[i] + "$image_split$";
          this.reqrejectimage += itemImg;
        }
      }
    },
    onPreview(imgList) {
      this.viewerList = [imgList];
      this.showViewer = true
    },
    closeViewer() {
      this.viewerList = [];
      this.showViewer = false
    },
    // 按钮键值触发事件绑定
    RegKeyEvent(that) {
      let _self = that;
      let code1 = 0;
      let code2 = 0;
      document.onkeydown = function (e) {
        let key = window.event.keyCode;
        console.log(key);
        switch (key) {
          case _self.keyEvent.lisshortcutkeypageup:
            if (_self.pagebylist) {
              if (_self.$refs.rmLabReportCollect.dialogCollectVisible) _self.SpecnoExchange(0, 0);
              else _self.SpecnoExchangeByList(0);
            } else {
              _self.SpecnoExchange(0, 0);
            }
            break;
          case _self.keyEvent.lisshortcutkeypagedown:
            if (_self.pagebylist) {
              if (_self.$refs.rmLabReportCollect.dialogCollectVisible) _self.SpecnoExchange(1, 0);
              else _self.SpecnoExchangeByList(1);
            } else {
              _self.SpecnoExchange(1, 0);
            }
            break;
          case 38:
            _self.SetReportLooked(0);
            break;
          case 40:
            _self.SetReportLooked(1);
            break;
          case _self.keyEvent.lisshortcutkeyf2:
            if (!_self.btndisabled) {
              _self.ResultAddAsync();
            }
            break;
          case _self.keyEvent.lisshortcutkeyf3:
            if (!_self.btndisabled) {
              _self.$refs.rmlabresult.ResultDelAsync();
            }
            break;
          case _self.keyEvent.lisshortcutkeyf6:
            if (!_self.btndisabled) {
              _self.SaveReportandResult(2, _self.selectdate, _self.rptunitid);
            }
            break;
          case _self.keyEvent.lisshortcutkeyf7:
            _self.CheckPrint(1);
            break;
          case _self.keyEvent.lisshortcutkeyf8:
            _self.CheckReport();
            break;
          case _self.keyEvent.lisshortcutkeyf11:
            _self.CollectDeal();
            break;
          case 18:
            code1 = 1;
            break;
          case 84:
            code2 = 1;
            break;
          case 17:
            if (!_self.ctrll) {
              _self.ctrll = true;
            }
            break;
          case 16:
            _self.shiftl = true;
            break;
        }
        //alt+D
        if (window.event.altKey && key == 68) {
          _self.dialogDelVisible = true;
        } else if (window.event.altKey && key == 82) {
          _self.RefreshList();
        }
      };
      document.onkeyup = function (e) {
        let key = window.event.keyCode;
        switch (key) {
          case 18:
            code1 = 0;
            break;
          case 84:
            code2 = 0;
            break;
          case 17:
            if (_self.ctrll) {
              _self.ctrll = false;
            }
            break;
          case 16:
            _self.shiftl = false;
            break;
        }
      };
    },
    //转换键盘按名称到值对应
    Convertkeyvalue(value) {
      switch (value) {
        case "F1":
          return 112;
        case "F2":
          return 113;
        case "F3":
          return 114;
        case "F4":
          return 115;
        case "F5":
          return 116;
        case "F6":
          return 117;
        case "F7":
          return 118;
        case "F8":
          return 119;
        case "F9":
          return 120;
        case "F10":
          return 121;
        case "F11":
          return 122;
        case "F12":
          return 123;
        case "downward":
          return 40;
        case "upward":
          return 38;
        case "pageup":
          return 33;
        case "pagedown":
          return 34;
        default:
          return 0;
      }
    },
    // 查询标本后页面赋值
    SetInfoByRow(findrow, exacnum) {
      return new Promise((s, f) => {
        this.$pub.Log("开始查询下一个标本");
        this.$refs.rmlabresult.QueryResult(findrow).then((res) => {
          this.$pub.Log("下一个标本查询结束");
          if (!res.hasOwnProperty("res")) {
            res.res = res;
            res.redo = "";
            res.history = 0;
          }
          this.Patredoflag = !!res.redo;
          this.PatHistoryNum = res.history;
          if (this.PRGNO == "LIS311") {
            if (res.iscontainBacteria) {
              this.showPatHistoryNum = res.history;
            } else {
              this.showPatHistoryNum = 0;
            }
          } else {
            this.showPatHistoryNum = res.history;
          }
          var row = XE.clone(res.res, true);

          this.PatientInfo = this.PatientInfoGetname(row);
          this.OldPatientInfo = this.PatientInfoGetname(row);
          this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
          this.AfterQResult(row.reportid, this);

          this.specno = res.sampleno ? res.sampleno : this.specno;
          if (row) {
            if (!this.specno) this.specno = row.sampleno;
            this.selectdate = row.sampledate;
          } else if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) {
            this.selectdate = this.sysdate + " 00:00:00";
          }
          var listrow = this.$refs.xTableList.afterFullData.filter((item) => item.sampleno == this.specno && item.sampledate == row.sampledate && item.rptunitid == this.rptunitid);
          if (listrow.length > 0) {
            this.$pub.Log("下一个标本赋值结束");
            this.$refs.xTableList.scrollToRow(listrow[0]);
            this.$refs.xTableList.setCurrentRow(listrow[0]);
            // var scrollrow = listrow[0];
            // if (this.Begincheckmode) {
            //     var rowindex = this.$refs.xTableList.afterFullData.indexOf(listrow[0]);

            //     if (rowindex < this.$refs.xTableList.afterFullData.length - 7) scrollrow = this.$refs.xTableList.afterFullData[rowindex + 7];
            //     else scrollrow = this.$refs.xTableList.afterFullData[this.$refs.xTableList.afterFullData.length - 1];
            // }
          } else {
            this.$refs.xTableList.clearCurrentRow();
          }
          s();
        });
      });
    },
    // 添加新标本
    AddNewReport() {
      return new Promise((s, f) => {
        //还有 加载默认值、自动记忆上次值的功能 未完成 TODO
        this.InitPatientInfo();
        this.specialtypena = "";
        this.$refs.rmlabresult.ClearTableDate();
        this.SpecAddflag = 1;
        var nowspec = XE.clone(this.specno, true);
        this.$refs.rmlabresult
          .QueryResult(this.PatientInfo)
          .then((res) => {
            if (!res.hasOwnProperty("res")) {
              res.res = res;
              res.redo = "";
              res.history = 0;
            }

            this.Patredoflag = !!res.redo;
            this.PatHistoryNum = res.history;
            if (this.PRGNO == "LIS311") {
              if (res.iscontainBacteria) {
                this.showPatHistoryNum = res.history;
              } else {
                this.showPatHistoryNum = 0;
              }
            } else {
              this.showPatHistoryNum = res.history;
            }
            this.ChangeAsTab();
            var row = XE.clone(res.res, true);
            this.PatientInfo = this.PatientInfoGetname(row);
            this.OldPatientInfo = this.PatientInfoGetname(row);

            //this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
            // var listrow = this.$refs.xTableList.tableFullData.find(item => item.reportid == row.reportid);
            // if (listrow) {
            //     this.$refs.xTableList.setCurrentRow(listrow).then(() => {
            //         this.$refs.xTableList.scrollToRow(listrow);
            //     });
            // }
            // this.specno = this.PatientInfo.sampleno;
            if (row) {
              if (this.specno) this.specno = row.sampleno;
              this.selectdate = row.sampledate;
              //在标本号框里面输入条码号匹配到标本后，LIS6的做法是切换日期后，刷新右侧列表
              //我们这里直接在右侧列表增加一行吧
              this.AfterQResult(row.reportid, this);
              if (!this.tableDataListS.find((t) => t.reportid == row.reportid)) {
                this.tableDataListS.push(JSON.parse(JSON.stringify(this.PatientInfo)));
                this.TotalPatNum = this.TotalPatNum + 1;
                if (this.PatientInfo.rechkflag == "9") this.ExactNum = this.ExactNum + 1;
                else this.UnExactNum = this.UnExactNum + 1;
                var that = this;
                setTimeout(() => {
                  let frow = that.$refs.xTableList.tableFullData.find((t) => t.reportid == row.reportid);
                  if (frow) {
                    that.$refs.xTableList.scrollToRow(frow);
                    that.$refs.xTableList.setCurrentRow(frow);
                  }
                }, 1);
              }
              // this.QueryList(4).then(r=>{
              //     this.AfterQResult(row.reportid, this);
              //     s();
              // });
            } else if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) {
              this.selectdate = this.sysdate + " 00:00:00";
              this.specno = res.sampleno ? res.sampleno : this.specno;
              this.PatientInfo.sampledate = this.selectdate;
              this.OldPatientInfo.sampledate = this.selectdate;
              this.AfterQResult(null, this);
            } else {
              this.specno = res.sampleno ? res.sampleno : this.specno;
              this.PatientInfo.sampledate = this.selectdate;
              this.OldPatientInfo.sampledate = this.selectdate;
              this.AfterQResult(null, this);
            }
            this.tableDataList = XE.clone(this.tableDataListS, true);
            s();
          })
          .catch(() => {
            this.ChangeAsTab();
            f();
          });
        // this.Queryreportinfo()
        //     .then(() => {
        //         //this.AfterQResult();
        //         s();
        //     })
        //     .catch(() => {

        //         s();
        //     });

        this.$nextTick(() => {
          if (this.$refs.barcode && this.$refs.barcode[0]) {
            this.$refs.barcode[0].select();
          }
        });
      });
    },
    //后台查询选项 multirpt--默认是否打开多开 units--默认打开的多个报告单元
    GetOptions(rptunitid, multirpt, units) {
      if (this.lis310multiple == "1") {
        //记录 RptPageInfo
        var pageinfo = this.$tool.getSession("RptPageInfo");
        var pagearr = [];
        if (pageinfo) {
          pagearr = JSON.parse(pageinfo);
          // if (pagearr) {
          //     var index = pagearr.findIndex(item => item.path == this.$route.fullPath);
          //     if (index > -1) {
          //         pagearr.splice(index, 1);
          //     }
          // }
        }
        if (multirpt == "1") {
          //pagearr.push({ id: this.$route.query.id - 0, rptunitid: rptunitid, path: this.$route.fullPath, multi: units });
          // var rptunits = units.split(",");
          // var index = rptunits.indexOf(rptunitid);
          // if (index == 0) {
          //     for (let i = 0; i < rptunits.length; i++) {
          //         pagearr.push({ id: this.$route.query.id - 0 + i, rptunitid: rptunits[i], path: "/" + this.PRGNO + "?id=" + (this.$route.query.id - 0 + i), multi: units });
          //     }
          //     this.$pub.lis310id = this.$route.query.id - 0 + rptunits.length - 1;
          // }
        } else {
          var findrpw = pagearr.find((item) => item.id == this.$route.query.id);
          if (findrpw) {
            findrpw.rptunitid = rptunitid;
          } else {
            pagearr.push({ id: this.$route.query.id, rptunitid: rptunitid, path: this.$route.fullPath, multi: "" });
          }
        }
        //this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
      } else {
        var pageinfo = this.$tool.getSession("RptPageInfo");
        var pagearr = [];
        pagearr.push({ id: 0, rptunitid: rptunitid, path: this.$route.fullPath, multi: "" });
        this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
      }
      return new Promise((s, f) => {
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            data: {
              action: "getoptions",
              rptunitid: rptunitid,
              prgno: this.PRGNO,
            },
          })
          .then((res) => {
            //console.log(res);
            // res.currentuser2group = "1";
            // res.resultstralignmentright = "1";
            this.basecolor = "#" + this.ColorChange(res.basecolor);
            this.pattypeinfo = [];
            this.reqgroupinfo = [];
            res.pattypeinfo.forEach((item) => {
              item.color = "#" + this.ColorChange(item.color);
              this.pattypeinfo.push(item);
            });
            res.reqgroupinfo.forEach((item) => {
              item.reportcolor = "#" + this.ColorChange(item.reportcolor);
              this.reqgroupinfo.push(item);
            });
            console.log(this.pattypeinfo);
            console.log(this.reqgroupinfo);
            this.Options = res.opts;
            this.mustPhotoStr = res.mustPhotoStr;
            if (this.lis310multiple == "1") {
              if (this.myreport) {
                this.$tool.setTitle("报告: 我的报告(所有)");
              } else if (this.mygreport) {
                this.$tool.setTitle("报告: 本组报告");
              } else if (!!this.rptunitgroup) {
                var filter = this.rptunitgroupfilter.find(item => item.rptunitgroupid == this.rptunitgroup);
                if (filter) this.$tool.setTitle("报告: " + filter.rptunitgroupname);
              } else {
                var pageinfo = this.$tool.getSession("RptPageInfo");
                var pagearr = [];
                if (pageinfo) {
                  pagearr = JSON.parse(pageinfo);
                }
                var pageobj = pagearr.find((item) => item.rptunitid == rptunitid);
                //console.log("path", pageobj.path, this.$route.fullPath);
                if (pageobj) this.$tool.setTitle((this.myunitreport ? "我的报告:" : "报告:") + this.Options.rptunit.rptunitname, pageobj.path);
                else this.$tool.setTitle((this.myunitreport ? "我的报告:" : "报告:") + this.Options.rptunit.rptunitname);
              }
            }
            if (!this.Options) this.Options = {};
            //报告列表刷新后留在所选日期选中时锁定日期
            this.lockselectdate = this.Options.refreshnottotoday == 1;
            //重置日期提醒标志
            this.nottodayalertflag = true;
            this.Options.rCols = res.rCols;
            this.Options.marrowOptions = res.marrowOptions;
            this.Options.pattypeOptions = res.pattypeOptions;
            if (this.Options && this.Options.userfilter) this.Customfilter = this.Options.userfilter;
            if (this.Options && this.Options.rptunitgroupfilter) this.rptunitgroupfilter = this.Options.rptunitgroupfilter;
            //this.Options.input_tp_list = "1,2,3,6";
            this.Tablist = this.Options.input_tp_list;
            if (!this.Tablist) this.Tablist = "";
            let headerMoreItem = [];
            if (res.rightitem && res.rightitem.length > 0) {
              this.RightItem = [];
              children: [{ label: "翻译成简体中文" }, { label: "翻译成繁体中文" }];
              var that = this;
              var childrenitems = [];
              for (let i = 0; i < res.rightitem.length; i++) {
                var nerrgight = {
                  label: res.rightitem[i].menuname,
                  field: res.rightitem[i].menuevent,
                  onClick: () => {
                    that.ButtonSwitch(res.rightitem[i].menuevent);
                    // if (res.rightitem[i].menuevent == "BeforeUnCheckReport") {
                    //     eval("that." + res.rightitem[i].menuevent + "('" + this.exactusernorhk + "')");
                    // } else if (res.rightitem[i].menuevent == "CheckPrint") {
                    //     eval("that." + res.rightitem[i].menuevent + "('2')");
                    // } else {
                    //     eval("that." + res.rightitem[i].menuevent + "()");
                    // }
                  },
                };
                if (res.rightitem[i].menuevent == "btnSetSignMode" && this.Options.checkmustsignname != "1") continue;
                headerMoreItem.push(res.rightitem[i]);
                if (res.rightitem[i].menulevel == "1") this.RightItem.push(nerrgight);
                else if (res.rightitem[i].menulevel == "2") childrenitems.push(nerrgight);
              }
              if (childrenitems.length > 0) {
                var nerrgight = {
                  label: "更多...",
                  field: "More...",
                  children: childrenitems,
                };
                this.RightItem.push(nerrgight);
              }
            } else this.RightItem = this.RightItemAll;
            if (this.Tablist && this.Tablist.split(",").indexOf("12") < 0) {
              this.RightItem = this.RightItem.filter((item) => item.label != "显示样本图像浮动窗口");
              headerMoreItem = headerMoreItem.filter((item) => item.menuname != "显示样本图像浮动窗口");
            }

            if (this.Options.currentuser2group > 0) this.myreportname = "本组报告";
            // 修改审核模式下中间结果列刷新的问题
            this.$refs.rmlabresult.RefreshOptions(this.Options, this.Begincheckmode);
            //this.$refs.rmlabresult.RefreshOptions(this.Options);
            //mod end

            if (this.Options.listshowuncheck != "0" && this.Options.listshowuncheck != "" && this.Options.listshowuncheck != "全部") {
              this.ListSearchFilter.Checkflag = this.Options.listshowuncheck;
              this.listStatus = "";
              for (var key in this.ListSearchFilter) {
                if (this.ListSearchFilter[key] && this.ListSearchFilter[key] != "全部") {
                  if (key == "Custom") {
                    this.listStatus += this.ListSearchFilter.Custom + ",";
                  } else {
                    this.listStatus += this.ListSearchFilter[key] + ",";
                  }
                }
              }
              if (this.ListSearchpattype != "全部") {
                this.listStatus += this.ListSearchpattype + ",";
              }
              if (this.ListSearchOtherflag != "全部") {
                this.listStatus += this.ListSearchOtherflag + ",";
              }
              if (this.listStatus) this.listStatus = this.listStatus.substring(0, this.listStatus.length - 1);
            }
            if (this.Options.nextuselistpage == "1") this.pagebylist = true;
            // pageseting由字符串改成json对象，方便后续再增加选项
            this.ConfigDetail = this.Options.pageseting;
            // if (this.Options.pageseting) {
            //     var pageseting = this.Options.pageseting.split(",");
            //     for (let i = 0; i < pageseting.length - 1; i++) {
            //         if (pageseting[i] > 0) this.ConfigDetail.push(true);
            //         else this.ConfigDetail.push(false);
            //     }
            //     this.ConfigDetail.push(pageseting[pageseting.length - 1]);
            // }
            if (this.Options.checkmustsignname == "1") {
              this.exactusernoreport = "";
              this.exactusernamereport = "";
            }
            if (this.Options.rechkdefaultuseloginuser == "1" && !this.exactusernorhk) {
              this.exactusernorhk = this.$tool.getSession(this.$tool.loginuserno);
              this.exactusernamerhk = this.$tool.getSession(this.$tool.loginusername);
            }
            if (this.Options.signdefaultuseloginuser == "1" && !this.exactusernoreport) {
              this.exactusernoreport = this.$tool.getSession(this.$tool.loginuserno);
              this.exactusernamereport = this.$tool.getSession(this.$tool.loginusername);
            }
            this.reportmarks = [];
            for (let i = 0; i < this.Options.reportmarks.length; i++) {
              this.reportmarks.push({ label: this.Options.reportmarks[i].codena, value: this.Options.reportmarks[i].codena });
            }
            this.specialpattypes = this.Options.specialpattypes;
            this.CurveShow = this.Options.refshowcurve == "1";
            var keychangeflag = false;
            for (var keykey in this.keyEvent) {
              if (this.Options[keykey] != "") {
                this.keyEvent[keykey] = this.Convertkeyvalue(this.Options[keykey]);
                keychangeflag = true;
              }
            }
            console.log(this.keyEvent);
            if (keychangeflag) this.RegKeyEvent(this);
            if (this.Options.showpager == "1") this.showpagenation = true;
            else this.showpagenation = false;
            //
            this.locktime = res.locktime;
            this.isalwaysrechkuser = res.isalwaysrechkuser;
            this.RefreshLock();
            console.log("showpage", this.Options.showpager, this.showpagenation);
            this.$emit("OptionsChange", { Options: this.Options, RightItem: res.rightitem, checkmode: "0", Begincheckmode: this.Begincheckmode });
            // if (this.lis310multiple == "1" && multirpt == "1") {
            //     var rptunits = units.split(",");
            //     var index = rptunits.indexOf(rptunitid);
            //     if (index < rptunits.length - 1) {
            //         this.$router.push(this.PRGNO + "?id=" + (this.$route.query.id - 0 + 1));
            //     }
            //     // if (this.$route.query.id < 4) {
            //     //     this.$router.push(this.PRGNO + "?id=" + (this.$route.query.id - 0 + 1));
            //     // }
            // }
            s();
            //this.QueryList(0);
          });
      }).catch((err) => {
        console.log("获取选项失败" + err);
      });
    },
    // 刷新页面
    QueryList(type) {
      //type= 1 报告单元刷新 type = 2 日期刷新 type =3 点刷新按钮刷新 type=4 单独刷新右侧列表，用在在标本号框内扫描条码查出非当天的标本，页面上标本日期切换过去后，把列表也刷新
      return new Promise((s, f) => {
        this.specialtypena = "";//刷新时特殊病人标记先去掉
        this.changekeyflag = false;
        this.loadingList = true;
        this.checkingflag = false;
        if (type == 3) {
          this.selectdate = this.lockselectdate ? this.selectdate : this.sysdate + " 00:00:00";
        }
        this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :查询开始 " + "\r\n";
        //this.$pub.Log("查询开始：");
        this.$tool.clearStatusbarMsg(4); //清空状态栏显示的行号
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            timeout: 300000,
            data: {
              action: "queryrptlist",
              rptunitid: this.rptunitid,
              sampledate: this.selectdate,
              ismyreport: this.myreport ? "1" : "0",
              ismygreport: this.mygreport ? "1" : "0",
              ismyunitreport: this.myunitreport ? "1" : "0",
              rptunitgroup: this.rptunitgroup,
              filtertxt: this.listStatus,
              reportid: this.PatientInfo.reportid,
              type: type,
              pagesize: this.tableListPage.pageSize,
              currentpage: this.tableListPage.currentPage,
              prgno: this.PRGNO,
            },
          })
          .then((res) => {
            // if (this.Options.listsortbyemer) {
            //     res.Data = res.Data.sort((a, b) => a.emer_flag - b.emer_flag);
            // }
            this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :请求结束" + "\r\n";
            if (type == 4) {
              this.tableDataListS = res.RData.Data;
              this.tableDataList = XE.clone(res.RData.Data, true);
              this.tableListColumn = res.RData.Cols;
              this.loadingList = false;
              //type=4的默认下是由于查询到病人信息后导致的列表切换，直接定位到当前的病人信息对应的标本号
              setTimeout(() => {
                this.CalcNum(res.RData.Data);
                let frow = this.$refs.xTableList.tableFullData.find((t) => t.reportid == this.PatientInfo.reportid);
                if (frow) {
                  this.$refs.xTableList.scrollToRow(frow);
                  this.$refs.xTableList.setCurrentRow(frow);
                  //开启特殊患者关注项目提醒
                  if (this.Options.specialpatconcernitemalert == "1") {
                    this.queryConcernItem(frow.reportid);
                  }
                  //获取特殊标记
                  this.Queryreportmark(frow);
                }
              }, 1);
              this.logcontent = "";
            } else {
              //this.$pub.Log("请求结束：" + Date.now());
              if (res.reportinfo) {
                this.PatientInfo = this.PatientInfoGetname(res.reportinfo);
                this.ReportLogid = this.PatientInfo.reportid;
                this.OldPatientInfo = this.PatientInfoGetname(res.reportinfo);
                //this.PatientInfo = res.reportinfo;
                //this.OldPatientInfo = res.reportinfo;
                this.selectdate = res.reportinfo.sampledate;
                this.specno = res.reportinfo.sampleno;
                this.oldbarcode = res.reportinfo.barcode;
                //mod by yangl 2021-03-16 先把骨髓报告的单独处理一下
                if (this.PRGNO == "LIS313" || this.PRGNO == "LIS312" || this.PRGNO == "LIS314") this.$refs.rmlabresult.QueryResult(res.reportinfo);
                else {
                  if (this.PRGNO == "LIS310" && res.results.length > 0) {
                    this.$refs.rmlabresult.dealCompResultstr(res.results);
                  }
                  if (this.Options.doubleresultcol == "1") {
                    this.$refs.rmlabresult.tableDataResult = [];
                    this.$refs.rmlabresult.tableDataResult1 = [];
                    var cnt = this.Options.doubleresultrows;
                    for (let index = 0; index < res.results.length; index++) {
                      const element = res.results[index];
                      if (index < cnt) {
                        this.$refs.rmlabresult.tableDataResult.push(element);
                      }
                      else {
                        this.$refs.rmlabresult.tableDataResult1.push(element);
                      }
                    }
                  }
                  else {
                    this.$refs.rmlabresult.tableDataResult = res.results;
                  }

                }
                //Mod by yangl 2021-03-22  修正药敏结果不显示的BUG，参数对不上
                if (this.PRGNO == "LIS311" && res.results && res.results.length > 0) this.$refs.rmlabresult.QueryMed(res.results[0]);
                else if (this.PRGNO == "LIS311" && res.results && res.results.length == 0) this.$refs.rmlabresult.QueryMed();
                this.tableDataListS = res.RData.Data;
                this.tableDataList = XE.clone(res.RData.Data, true);
                this.tableListColumn = res.RData.Cols;
                this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :tableDataListS赋值结束" + "\r\n";
                //this.$pub.Log("tableDataListS赋值结束：" + Date.now());
                this.loadingList = false;
                setTimeout(() => {
                  this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :开始nexttick找到当前行并置高亮" + "\r\n";
                  //this.$pub.Log("开始nexttick找到当前行并置高亮" + Date.now());
                  this.CalcNum(res.RData.Data);
                  var row = this.$refs.xTableList.tableFullData.find((item) => item.sampleno == this.PatientInfo.sampleno && item.sampledate == this.PatientInfo.sampledate && item.rptunitid == this.PatientInfo.rptunitid);
                  //console.log("therow", row);
                  if (row) {
                    var that = this;
                    //设置高亮行setCurrentRow会改变行内容，导致scscrollToRow失效，因此不能将scrollToRow放在setCurrentRow的then中执行
                    this.$refs.xTableList.scrollToRow(row);
                    this.$refs.xTableList.setCurrentRow(row);
                    //this.$refs.xTableList.scrollTo(0, rowindex);
                    this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :置高亮行结束: " + row.reportid + "\r\n";
                    this.$pub.Log(this.logcontent);
                    this.logcontent = "";
                    //开启特殊患者关注项目提醒
                    if (this.Options.specialpatconcernitemalert == "1") {
                      this.queryConcernItem(row.reportid);
                    }
                    //获取特殊标记
                    this.Queryreportmark(row);
                  } else {
                    //this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :没有找到对应的行: " + row.reportid + "\r\n";
                    this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :没有找到对应的行: \r\n";
                    this.$pub.Log(this.logcontent);
                    this.logcontent = "";
                  }
                }, 1);
                s();
                //del by yangl 2021-03-22  修正右侧列表显示多天时，切换到今日切换不了的BUG；
                //} else if (res.RData.Data.length > 0) {
                // this.specno = res.RData.Data[0].sampleno;
                // this.$refs.xTableList.setCurrentRow(res.RData.Data[0]);
                // this.$refs.rmlabresult.QueryResult(res.RData.Data[0]).then(res => {
                //     if (!res.hasOwnProperty("res")) {
                //         res.res = res;
                //         res.redo = "";
                //         res.history = 0;
                //     }
                //     this.Patredoflag = !!res.redo;
                //     this.PatHistoryNum = res.history;
                //     var row = XE.clone(res.res, true);
                //     this.PatientInfo = this.PatientInfoGetname(row);
                //     this.OldPatientInfo = this.PatientInfoGetname(row);
                //     this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
                //     this.specno = this.PatientInfo.sampleno;
                //     if (this.prgno == "LIS311") this.$refs.rmlabresult.QueryMed();
                // });
                // this.tableDataListS = res.RData.Data;
                // this.tableDataList = XE.clone(res.RData.Data, true);
                // this.tableListColumn = res.RData.Cols;
                // this.loadingList = false;
                // this.CalcNum(res.RData.Data);
                // if (this.PRGNO == "LIS311") this.$refs.rmlabresult.QueryMed();
                // this.$pub.Log(this.logcontent);
                // this.logcontent = "";
                //         this.specno = this.PatientInfo.sampleno;
                //         if (this.prgno == "LIS311") this.$refs.rmlabresult.QueryMed();
                //     });
                //     this.tableDataListS = res.RData.Data;
                //     this.tableDataList = XE.clone(res.RData.Data, true);
                //     this.tableListColumn = res.RData.Cols;
                //     this.loadingList = false;
                //     this.CalcNum(res.RData.Data);
                //     if (this.PRGNO == "LIS311") this.$refs.rmlabresult.QueryMed();
                //     this.$pub.Log(this.logcontent);
                //     this.logcontent = "";
              } else {
                //mod by yangliang 2021-05-08 标本号唯一时，刷新后没有取到要当前要显示的报告时，后台返回当前最大标本号+1
                this.specno = res.retsmpno; // "1"; //刷新后没有取到要当前要显示的报告时，将标本号设为1 后台要保证标本号1没有对应的报告
                this.InitPatientInfo();
                this.tableDataListS = res.RData.Data;
                this.tableDataList = XE.clone(res.RData.Data, true);
                this.tableListColumn = res.RData.Cols;
                this.loadingList = false;
                //mod by yangl 2021-03-16 先把骨髓报告的单独处理一下
                if (this.PRGNO != "LIS313" && this.PRGNO != "LIS312" && this.PRGNO != "LIS314") this.$refs.rmlabresult.tableDataResult = [];
                else this.$refs.rmlabresult.QueryResult({ reportid: "" });
                this.CalcNum(res.RData.Data);
                if (this.PRGNO == "LIS311") this.$refs.rmlabresult.QueryMed();
                this.$pub.Log(this.logcontent);
                this.logcontent = "";
              }
            }
            s();
            if (this.listsearchkey != "") this.listsearch();
            if (this.$refs.rmlabresult.showtabid == 2) {
              if (this.PatientInfo && this.PatientInfo.reportid) {
                this.$refs.rmlabresult.queryreportview(this.PatientInfo.reportid);
              } else {
                this.$refs.rmlabresult.queryreportview("no");
              }
            }
            if (this.PRGNO == "LIS310") {
              if (this.PatientInfo && this.PatientInfo.reportid) {
                this.$refs.rmlabresult.queryreportpdf(this.PatientInfo.reportid);
              } else {
                this.$refs.rmlabresult.queryreportpdf("no");
              }
            }
            if ((res.nocharge && res.nocharge.length > 0) || (res.overtime && res.overtime.length > 0) || (res.markrpt && res.markrpt.length > 0)) {
              this.tableDataoncharge = res.nocharge ? res.nocharge : [];
              this.tableDataOvertime = res.overtime ? res.overtime : [];
              this.tableDatarptMark = res.markrpt ? res.markrpt : [];
              this.dialogListTipsVisible = true;
            }
            if (this.Options.showpager == "1") {
              this.tableListPage.totalResult = res.totalrowcnt;
            }
            //     if (type == 3) {

            //     } else {
            //         this.tableDataListS = res.RData.Data;
            //         this.tableDataList = XE.clone(res.RData.Data, true);
            //         this.$pub.Log("tableDataListS赋值结束：" + Date.now());
            //         this.tableListColumn = res.RData.Cols;
            //         this.$pub.Log("data赋值结束：" + Date.now());
            //         var selectdata = {};
            //         if (type == 1) selectdata = res.RData.Data;
            //         else selectdata = res.RData.Data.filter((item) => item.sampledate == this.selectdate);
            //         this.loadingList = false;
            //         this.$pub.Log("loading结束：" + Date.now());
            //         this.$nextTick(() => {
            //             if (selectdata.length > 0) {
            //                 this.$refs.xTableList.setCurrentRow(selectdata[0]);
            //                 this.specno = selectdata[0].sampleno;
            //                 this.$refs.rmlabresult
            //                     .QueryResult(selectdata[0])
            //                     .then((res) => {
            //                         if (!res.hasOwnProperty("res")) {
            //                             res.res = res;
            //                             res.redo = "";
            //                             res.history = 0;
            //                         }
            //                         this.Patredoflag = !!res.redo;
            //                         this.PatHistoryNum = res.history;
            //                         var row = XE.clone(res.res, true);
            //                         this.PatientInfo = this.PatientInfoGetname(row);
            //                         this.OldPatientInfo = this.PatientInfoGetname(row);
            //                         this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
            //                         this.AfterQResult(row.reportid, this);
            //                         var listrow = this.$refs.xTableList.tableFullData.find((item) => item.reportid == row.reportid);
            //                         this.$refs.xTableList.setCurrentRow(listrow).then(() => {
            //                             this.$refs.xTableList.scrollToRow(listrow);
            //                         });
            //                         this.ChangeAsTab();
            //                         this.tableDataList = XE.clone(this.tableDataListS, true);
            //                         s();
            //                     })
            //                     .catch(() => {
            //                         this.ChangeAsTab();
            //                     });
            //             } else {
            //                 if (this.$refs.xTableList.tableFullData.length > 0) {
            //                     if (this.SpecAddflag > 0) {
            //                         var row = this.$refs.xTableList.tableFullData[this.$refs.xTableList.tableFullData.length - 1];
            //                         this.$refs.xTableList.setCurrentRow(row);
            //                         this.$refs.rmlabresult
            //                             .ClearTableDate()
            //                             .then(() => {
            //                                 this.ChangeAsTab();
            //                                 this.tableDataList = XE.clone(this.tableDataListS, true);
            //                                 s();
            //                             })
            //                             .catch(() => {
            //                                 this.ChangeAsTab();
            //                             });
            //                     } else {
            //                         this.specno = "1";
            //                         this.AddNewReport().then(() => {
            //                             // this.SpecAddflag = 1;
            //                             // this.$refs.rmlabresult
            //                             //         .QueryResult(this.PatientInfo)
            //                             //         .then((res) => {
            //                             //             if (!res.hasOwnProperty("res")) {
            //                             //                 res.res = res;
            //                             //                 res.redo = "";
            //                             //                 res.history = 0;
            //                             //             }
            //                             //             this.Patredoflag = !!res.redo;
            //                             //             this.PatHistoryNum = res.history;
            //                             //             this.ChangeAsTab();
            //                             //             var row = XE.clone(res.res, true);
            //                             //             this.PatientInfo = this.PatientInfoGetname(row);
            //                             //             this.OldPatientInfo = this.PatientInfoGetname(row);
            //                             //             this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
            //                             //             var listrow = this.$refs.xTableList.tableFullData.filter((item) => item.reportid == row.reportid)[0];
            //                             //             this.$refs.xTableList.setCurrentRow(listrow).then(() => {
            //                             //                 this.$refs.xTableList.scrollToRow(listrow);
            //                             //             });
            //                             //             this.specno = this.PatientInfo.sampleno;
            //                             //             this.AfterQResult(row.reportid, this);
            //                             //             this.tableDataList = XE.clone(this.tableDataListS, true);
            //                             //             s();
            //                             //         })
            //                             //         .catch(() => {
            //                             //             this.ChangeAsTab();
            //                             //         });
            //                         });
            //                     }
            //                 } else {
            //                     //console.log("new",this.$refs.xTableList.createRow())
            //                     this.specno = "1";
            //                     this.AddNewReport().then(() => {
            //                         this.SpecAddflag = 1;
            //                         this.ChangeAsTab();
            //                     });

            //                     // this.InitPatientInfo();
            //                     // this.PatientInfoClear().then(()=>{
            //                     //     this.PatientInfo = JSON.parse(JSON.stringfy(this.PatientInfo));
            //                     //     this.$refs.rmlabresult.ClearTableDate();
            //                     //     this.ChangeAsTab();
            //                     // });
            //                 }
            //             }
            //             this.CalcNum(res.RData.Data);
            //             // this.TotalPatNum = res.RData.Data.length;
            //             // this.ExactNum = res.RData.Data.filter((item) => item.rechkflag > 0).length;
            //             // this.UnExactNum = res.RData.Data.filter((item) => item.rechkflag == 0).length;
            //             // this.tempRowIndex = res.RData.Data.filter((item) => item._XID < this.PatientInfo._XID).length;
            //         });
            //     }
          })
          .catch((error) => {
            f();
            this.$message.error("错误:" + error);
          });
      });
    },
    // 保存报告和结果
    SaveReportandResult(type, date, unitid, then, must) {
      return new Promise((s, f) => {
        if (this.changekeyflag) {
          console.log(" 正在做barcode 或者 pat_no 的change事件，保存时直接报错吧");
          //正在做barcode 或者 pat_no 的change事件，保存时间直接报错吧
          f();
          return;
        }
        //&& this.PatientInfo.barcode
        this.changekeyflag = true;
        let ob = "";
        if (this.OldPatientInfo.barcode) {
          ob = this.OldPatientInfo.barcode;
        }
        let nb = "";
        if (this.PatientInfo.barcode) {
          nb = this.PatientInfo.barcode;
        }
        // console.log("nb", nb);
        // console.log("ob", ob);
        if (nb != ob) {
          this.ExecBarcodeChange()
            .then(() => {
              // console.log("ExecBarcodeChange    sssssssssssss");
              if (this.$refs && this.$refs.barcode && this.$refs.barcode[0]) {
                this.$refs.barcode[0].select();
              }
              this.CheckSamples(this.barcodePatientInfo);
              this.changekeyflag = false;
              s();
            })
            .catch(() => {
              console.log("ExecBarcodeChange    fffffffffff");
              this.changekeyflag = false;
              f();
            });
        } else if (this.OldPatientInfo.pat_no && this.PatientInfo.pat_no != this.OldPatientInfo.pat_no && this.PatientInfo.pat_no) {
          this.PatnoGetInfo(this.PatientInfo.pat_no, "pat_no")
            .then(() => {
              this.changekeyflag = false;
              // this.SaveAction(type, date, unitid, then)
              //     .then(() => {
              //         this.changekeyflag = false;
              //         s();
              //     })
              //     .catch(() => {
              //         //console.log("saveactionerr1");
              //         this.changekeyflag = false;
              //         f();
              //     });
            })
            .catch(() => {
              this.changekeyflag = false;
              // this.SaveAction(type, date, unitid, then)
              //     .then(() => {
              //         this.changekeyflag = false;
              //         s();
              //     })
              //     .catch(() => {
              //         this.changekeyflag = false;
              //         //console.log("saveactionerr2");
              //         f();
              //     });
            });
        } else {
          if (must === 1 || !this.ComparePatientInfo()) {
            if (this.Options.inputasreportuser != "1" && this.PatientInfo.report_user == "") {
              this.PatientInfo.report_username = this.exactusernamereport;
              this.PatientInfo.report_user = this.exactusernoreport;
            }
            this.SaveAction(type, date, unitid, then)
              .then(() => {
                this.changekeyflag = false;
                s();
              })
              .catch(() => {
                // console.log("catch");
                this.changekeyflag = false;
                //console.log("saveactionerr3");
                f();
              });
          } else {
            this.changekeyflag = false;
            s();
          }
        }
      });
    },
    // 保存前调整
    BeforSaveJudge(result, type) {
      return new Promise((s, f) => {
        this.SaveJudge(result, type)
          .then(() => {
            if (this.PRGNO == "LIS311") {
              this.$refs.rmlabresult.GetTotalMedData(this.PatientInfo.reportid);
              var meds = this.$refs.rmlabresult.MedTotalData;
              this.MedJudge(meds)
                .then(() => {
                  // this.MedRemind(meds,type,delmeds).then(()=>{
                  //     s();
                  // }).catch(()=>{
                  //     f();
                  // })
                  s();
                })
                .catch(() => {
                  f();
                });
            } else {
              s();
            }
          })
          .catch(() => {
            f();
          });
      });
    },
    // 保存调整
    async SaveJudge(result, type) {
      try {
        var medchange = false;
        if (this.Options.modifyresultmsg == "1" && type != "2") {
          let msgs = [];
          let h = this.$createElement;
          if (result.updateRecords.length > 0) {
            msgs.push(h('p', null, "当前报告有结果发生改动，是否保存?"));
            let uptinfo = "";
            result.updateRecords.forEach(e => {
              msgs.push(h('p', null, e.odata.rpt_itemname + ":" + e.odata.result_str + "  --> " + e.cdata.result_str));
            });
          }
          if (result.removeRecords.length > 0) {
            if (msgs.length == 0) {
              msgs.push(h('p', null, "当前报告有结果发生改动，是否保存?"));
            }
            let uptinfo = "";
            result.removeRecords.forEach(e => {
              msgs.push(h('p', null, "删除项目：" + e.rpt_itemname + "    (结果：" + e.result_str + ")"));
            });
          }
          if (result.insertRecords.length > 0) {
            if (msgs.length == 0) {
              msgs.push(h('p', null, "当前报告有结果发生改动，是否保存?"));
            }
            let uptinfo = "";
            result.insertRecords.forEach(e => {
              msgs.push(h('p', null, "新增项目：" + e.rpt_itemname + "    (结果：" + e.result_str + ")"));
            });
          }
          if (this.PRGNO == "LIS311") {
            this.$refs.rmlabresult.GetTotalMedData(this.PatientInfo.reportid);
            var meds = this.$refs.rmlabresult.MedTotalData;
            var delmeds = this.$refs.rmlabresult.DelMedTotalData;
            var resultlist = this.$refs.rmlabresult.$refs.xTableResult.tableFullData;//检验项目数据
            var medmsgs = [];
            if (meds && meds.length > 0) {
              var uplist = meds.filter((item) => item.updateflag == 2);//更新的数据
              var inslist = meds.filter((item) => item.updateflag == 1);//新增的数据
              if (uplist.length > 0) {
                if (!msgs || msgs.length == 0) {
                  medmsgs.push(h('p', null, "当前报告有药敏结果发生改动，是否保存?"));
                }
                var isdif = false;
                uplist.forEach(e => {
                  var resultitem = resultlist.find((item) => item.rpt_itemcode == e.rpt_itemcode);
                  var tipmsg = "";
                  if (resultitem) {
                    tipmsg += resultitem.rpt_itemname + ";";
                    if (e.medname != e.oldmedname) {
                      tipmsg += "修改抗生素:" + e.oldmedname + " --> " + e.medname + ";";
                      isdif = true;
                    } else {
                      tipmsg += "修改抗生素:" + e.medname + ";";
                    }
                    if (e.oldrad != e.rad) {
                      tipmsg += "Rad:" + e.oldrad + " --> " + e.rad + ";";
                      isdif = true;
                    }
                    if (e.oldmic != e.mic) {
                      tipmsg += "Mic:" + e.oldmic + " --> " + e.mic + ";";
                      isdif = true;
                    }
                    if (e.oldmedresult != e.medresult) {
                      tipmsg += "药敏结果:" + e.oldmedresult + " --> " + e.medresult + ";";
                      isdif = true;
                    }
                    if (isdif) {
                      medchange = true;
                      medmsgs.push(h('p', null, tipmsg));
                    }
                  }
                });
                if (!isdif) medmsgs = [];
              }

              if (inslist.length > 0) {
                if (medmsgs.length == 0) {
                  if (!msgs || msgs.length == 0) {
                    medmsgs.push(h('p', null, "当前报告有药敏结果发生改动，是否保存?"));
                  }
                }
                inslist.forEach(e => {
                  var resultitem = resultlist.find((item) => item.rpt_itemcode == e.rpt_itemcode);
                  var tipmsg = "";
                  if (resultitem) {
                    tipmsg += resultitem.rpt_itemname + ";";
                    tipmsg += "新增抗生素: " + e.medname + ";Rad: " + e.rad + ";Mic: " + e.mic + ";药敏结果: " + e.medresult + ";";
                    medchange = true;
                    medmsgs.push(h('p', null, tipmsg));
                  }
                })
              }
            }
            if (delmeds && delmeds.length > 0) {
              if (medmsgs.length == 0) {
                if (!msgs || msgs.length == 0) {
                  medmsgs.push(h('p', null, "当前报告有药敏结果发生改动，是否保存?"));
                }
              }
              delmeds.forEach(e => {
                var resultitem = resultlist.find((item) => item.rpt_itemcode == e.rpt_itemcode);
                var tipmsg = ""
                if (resultitem) {
                  tipmsg += resultitem.rpt_itemname + ";";

                  tipmsg += "删除抗生素: " + e.medname + ";";
                  if (e.rad) tipmsg += "Rad:" + e.rad + ";";
                  if (e.mic) tipmsg += "Mic:" + e.mic + ";";
                  if (e.medresult) tipmsg += "药敏结果:" + e.medresult + ";";
                  medchange = true;
                  medmsgs.push(h('p', null, tipmsg));
                }
              })
            }

            if (medmsgs && medmsgs.length > 0) {
              msgs = msgs.concat(medmsgs);
            }
          }
          if (msgs && msgs.length > 0) {
            let focuscancel = false;
            if (this.Options.modifyresultmsgdefyes == "2" || this.Options.modifyresultmsgdefyes == "4") {
              focuscancel = true;
            }
            if (msgs.length > 16) {
              msgs = msgs.splice(0, 16);
              msgs.push("........");
            }
            await this.$confirm("提示", {
              title: "提示",
              message: h('div', null, msgs),
              confirmButtonText: "确定", cancelButtonText: "取消",
              focusCancelButton: focuscancel,
              type: "warning",
            });
            if (this.Options.modifyresultmsgdefyes == "4") {
              await this.$confirm("提示", {
                title: "提示",
                message: h('div', null, msgs),
                confirmButtonText: "确定", cancelButtonText: "取消",
                focusCancelButton: focuscancel,
                type: "warning",
              });
            }
          }
        }
      } catch (e) {
        this.$refs.rmlabresult.$refs.xTableResult.revert();
        if (this.$refs.rmlabresult.$refs.xTableResult1) {
          this.$refs.rmlabresult.$refs.xTableResult1.revert();
        }
        // for (let i = 0; i < result.updateRecords.length; i++) {
        //     var updateobj = this.$refs.rmlabresult.$refs.xTableResult.tableFullData.find((item) => item.rpt_itemcode == result.updateRecords[i].odata.rpt_itemcode);
        //     for (var item in updateobj) {
        //         updateobj[item] = result.updateRecords[i].odata[item];
        //     }
        //     //this.CalcRef(updateobj);
        // }
        if (medchange) {
          this.$refs.rmlabresult.$refs.xTableMed.revert();//药敏还原更新
          this.$refs.rmlabresult.MedTotalData = [];//清空药敏
          this.$refs.rmlabresult.DelMedTotalData = [];//清空删除的药敏
          var fulldata = this.$refs.rmlabresult.$refs.xTableResult.tableFullData;
          if (fulldata && fulldata.length > 0) {
            var currentrow = this.$refs.rmlabresult.$refs.xTableResult.getData(0);
            if (this.$refs.rmlabresult.showmedrptitemcode) {
              currentrow = fulldata.find((item) => item.rpt_itemcode == this.$refs.rmlabresult.showmedrptitemcode);
            }
            //console.log("当前选中行currentrow",currentrow)
            this.$refs.rmlabresult.$refs.xTableResult.setCurrentRow(currentrow);

            this.$refs.rmlabresult.QueryMed(currentrow, currentrow.rpt_itemcode, currentrow.reportid, "1");
          }
        }
        this.changekeyflag = false;
        throw new Error('cancel');
      }
    },
    // 药敏调整
    MedJudge(meds) {
      return new Promise((s, f) => {
        var nullflag = false; //药敏结果是否有空结果判断
        this.MedjudgeAction = "";
        for (let medi = 0; medi < meds.length; medi++) {
          //药敏结果、RAD、MIC均为空才判断为药敏空结果，为空跳出循环
          if (meds[medi].medcode == "-9992DEL") continue;
          if ((meds[medi].medresult == "" || meds[medi].medresult == null) && (meds[medi].rad == "" || meds[medi].rad == null) && (meds[medi].mic == "" || meds[medi].mic == null)) {
            nullflag = true;
            break;
          }
        }
        if (nullflag) {
          switch (this.Options.allowmedresultnull) {
            case "0": //不提醒
              s();
              break;
            case "1": //提醒
              this.$confirm("当前药敏结果存在空结果,是否继续保存?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                focusCancelButton: false,
                type: "warning",
              })
                .then(() => {
                  s();
                })
                .catch(() => {
                  f();
                });
              break;
            case "2": //自动删除
              this.MedjudgeAction = "del";
              s();
              break;
            case "3": //提醒删除
              this.$confirm("当前药敏结果存在空结果,是否自动删除?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                focusCancelButton: false,
                type: "warning",
              })
                .then(() => {
                  this.MedjudgeAction = "del";
                  s();
                })
                .catch(() => {
                  this.MedjudgeAction = "";
                  s();
                });
              break;
            default:
              s();
              break;
          }
        } else {
          s();
        }
      });
    },
    // 执行保存
    SaveAction(type, date, unitid, then, isbybar, oldreport) {
      return new Promise((s, f) => {
        // const loading = this.$loading({
        //     lock: true,
        //     text: "保存中",
        //     spinner: "el-icon-loading",
        //     background: "rgba(255, 255, 255, 0.7)",
        // });
        if (this.PRGNO == "LIS313") {
          this.$refs.rmlabresult.beforeSaveReport();
        }

        var result = this.$refs.rmlabresult.$refs.xTableResult.getRecordset();
        // 判断合并table
        if (this.Options.doubleresultcol == "1" && this.$refs.rmlabresult.$refs.xTableResult1) {
          var result1 = this.$refs.rmlabresult.$refs.xTableResult1.getRecordset();
          result.updateRecords = result.updateRecords.concat(result1.updateRecords);
          result.insertRecords = result.insertRecords.concat(result1.insertRecords);
          result.removeRecords = result.removeRecords.concat(result1.removeRecords);
        }

        this.BeforSaveJudge(result, type)
          .then((judge) => {
            var meds = "";
            var sheet = "";
            if (this.PRGNO == "LIS311") {
              //console.log('11111');
              // gettotaldata放到medjudge里面去做
              this.$refs.rmlabresult.GetTotalMedData(this.PatientInfo.reportid);
              if (result.insertRecords && result.insertRecords.length > 0) {
                var reg = new RegExp("[0-9]{1,}", "gi");
                result.insertRecords.sort((a, b) => a._XID.match(reg) - 0 - (b._XID.match(reg) - 0));
              }
              // if (this.$refs.rmlabresult.$refs.xTableMed.getTableData().fullData.length > 0) {
              //     var rptcode = this.$refs.rmlabresult.$refs.xTableMed.tableFullData[0].rpt_itemcode;
              //     this.$refs.rmlabresult.MedTotalData = this.$refs.rmlabresult.MedTotalData.filter(item => item.rpt_itemcode != rptcode && item.reportid == this.PatientInfo.reportid);
              //     for (let i = 0; i < this.$refs.rmlabresult.$refs.xTableMed.tableFullData.length; i++) {
              //         this.$refs.rmlabresult.MedTotalData.push(this.$refs.rmlabresult.$refs.xTableMed.tableFullData[i]);
              //     }
              // }
              // else{
              //     var removerows = this.$refs.rmlabresult.$refs.xTableMed.getRemoveRecords();
              //     if(removerows.length>0)
              //     {
              //         var rptcode = removerows[0].rpt_itemcode;
              //         this.$refs.rmlabresult.MedTotalData = this.$refs.rmlabresult.MedTotalData.filter(item => item.rpt_itemcode != rptcode && item.reportid == this.PatientInfo.reportid);
              //             this.$refs.rmlabresult.MedTotalData.push({ reportid:this.PatientInfo.reportid,rpt_itemcode:rptcode,medcode:"-9992DEL" });

              //     }
              // }
              //meds = this.$refs.rmlabresult.MedTotalData;
              console.log("this.MedjudgeAction", this.MedjudgeAction);
              if (this.MedjudgeAction == "del" && (this.Options.allowmedresultnull == "2" || this.Options.allowmedresultnull == "3")) {
                this.$refs.rmlabresult.MedTotalDelNull();
              }
              meds = this.$refs.rmlabresult.MedTotalData;
              if (this.$refs.rmlabresult.ShowSheet) {
                sheet = { sheetdate: this.$refs.rmlabresult.Sheetdate, sheetuser: this.$refs.rmlabresult.Sheetuser, receiveuser: this.$refs.rmlabresult.Recieveuser, medium: this.$refs.rmlabresult.Medium, condtions: this.$refs.rmlabresult.Conditions, smear: this.$refs.rmlabresult.Smear, dyeing: this.$refs.rmlabresult.Dyeing, colonyresult: this.$refs.rmlabresult.ColonyResult, colonynum: this.$refs.rmlabresult.ColonyNum, otherresult: this.$refs.rmlabresult.OtherResult };
              }
              // if (this.$refs.rmlabresult.$refs.xTableResult.tableFullData.length > 0) {
              //     var rptcode = this.$refs.rmlabresult.$refs.xTableResult.getCurrentRow().rpt_itemcode;
              //     var medData = this.$refs.rmlabresult.MedTotalData.filter(item => item.rpt_itemcode != rptcode);
              //     for (let i = 0; i < this.$refs.rmlabresult.$refs.xTableMed.tableFullData.length; i++) {
              //         medData.push(this.$refs.rmlabresult.$refs.xTableMed.tableFullData[i]);
              //     }
              //     meds = medData;
              // }
            } else if (this.PRGNO == "LIS313") {
              //骨髓报告双列分表显示 新增xTableResult2数据内容
              if (this.$refs.rmlabresult.$refs.xTableResult2) {
                var result2 = this.$refs.rmlabresult.$refs.xTableResult2.getRecordset();
                result.updateRecords = result.updateRecords.concat(result2.updateRecords);
                result.insertRecords = result.insertRecords.concat(result2.insertRecords);
                result.removeRecords = result.removeRecords.concat(result2.removeRecords);
              }
              this.PatientInfo.txtinfo1 = this.$refs.rmlabresult.txtinfo1;
              this.PatientInfo.txtinfo2 = this.$refs.rmlabresult.txtinfo2;
              for (let i = result.updateRecords.length - 1; i >= 0; i--) {
                if (result.updateRecords[i].cdata.reportid == "") {
                  result.insertRecords.push(result.updateRecords[i].cdata);
                  result.updateRecords.splice(i, 1);
                }
              }
            }
            else if (this.PRGNO == "LIS314") {
              this.PatientInfo.txtinfo1 = this.$refs.rmlabresult.txtinfo1;
              this.PatientInfo.txtinfo2 = this.$refs.rmlabresult.txtinfo2;
              this.PatientInfo.lab_advice = this.$refs.rmlabresult.lab_advice;
            }

            var newflag = this.tableDataListS.filter((item) => item.sampleno == this.PatientInfo.sampleno && item.sampledate == this.PatientInfo.sampledate && item.rptunitid == this.PatientInfo.rptunitid).length == 0;
            // this.PatientInfo.sampleno = this.specno + "";
            // this.PatientInfo.sampledate = date + "";
            // this.PatientInfo.rptunitid = unitid + "";
            var imageinfo = [];
            if (this.ImageList.length > 0) {
              for (let i = 0; i < this.ImageList.length; i++) {
                imageinfo.push({ reportid: this.PatientInfo.reportid, graphitemno: this.ImageList[i].name, seq: this.ImageList[i].seq, extrainfo: this.ImageList[i].comm });
              }
            }
            if (oldreport) {
              this.OldPatientInfo = this.PatientInfoGetname(oldreport);
            }
            var p = this.$tool
              .request({
                url: "LIS/LIS3/LIS310",
                method: "post",
                data: {
                  action: "savereport",
                  rptinfo: this.PatientInfo,
                  oldrptinfo: this.OldPatientInfo,
                  results: result,
                  meds: meds,
                  sheet: sheet,
                  bybarcode: isbybar,
                  imageinfo: imageinfo.length > 0 ? imageinfo : "",
                  checkmode: this.Begincheckmode ? this.batsignmode : "", //0签名模式1审核模式 为空非审核模式保存
                },
              })
              .then((res) => {
                console.log("save", res);
                if (res.Item1 == 1) {
                  if (type == 2) {
                    this.$message({
                      type: "success",
                      message: "保存成功!",
                    });
                  }
                  if (newflag) {
                    this.PatientInfo.reportid = res.Item3;
                    this.PatientInfo.strsampledate = this.PatientInfo.sampledate.slice(2, 10);

                    //this.tableDataList.push(JSON.parse(JSON.stringify(this.PatientInfo)));
                    this.tableDataListS.push(JSON.parse(JSON.stringify(this.PatientInfo)));
                    this.OldPatientInfo = JSON.parse(JSON.stringify(this.PatientInfo));
                    this.$refs.rmlabresult
                      .QueryResult(this.PatientInfo)
                      .then((ress) => {
                        setTimeout(() => {
                          //this.$refs.xTableList.loadData(this.tableDataListS).then(() => {
                          var row = this.$refs.xTableList.tableFullData.find((item) => item.reportid == res.Item3);
                          if (row) {
                            this.$refs.xTableList.scrollToRow(row);
                            this.$refs.xTableList.setCurrentRow(row);
                            this.AfterQResult(row.reportid, this);
                          }
                          if (!ress.hasOwnProperty("res")) {
                            ress.res = res;
                            ress.redo = "";
                            ress.history = 0;
                          }
                          this.Patredoflag = !!ress.redo;
                          this.PatHistoryNum = ress.history;
                          var row = XE.clone(ress.res, true);
                          this.PatientInfo = this.PatientInfoGetname(row);

                          this.OldPatientInfo = this.PatientInfoGetname(row);
                          if (row) this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
                          this.specno = ress.sampleno ? ress.sampleno : this.specno;
                          if (row) {
                            if (!this.specno) this.specno = row.sampleno;
                            this.selectdate = row.sampledate;
                          } else if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) {
                            this.selectdate = this.sysdate + " 00:00:00";
                          }
                          if (this.prgno == "LIS311") this.$refs.rmlabresult.QueryMed();
                          this.CalcNum(this.$refs.xTableList.tableFullData);
                          // this.TotalPatNum += 1;
                          // this.ExactNum = this.$refs.xTableList.tableFullData.filter((item) => item.rechkflag > 0).length;
                          // this.UnExactNum = this.$refs.xTableList.tableFullData.filter((item) => item.rechkflag == 0).length;
                          // this.tempRowIndex = this.$refs.xTableList.tableFullData.filter((item) => item._XID < row[0]._XID).length;
                          //loading.close();
                          s();
                          //});
                        }, 1);
                      })
                      .catch(() => {
                        //loading.close();
                        f();
                      });
                  } else {
                    //console.log("sampleno",this.PatientInfo.sampleno);
                    var indexs = this.GetRowIndex(this.PatientInfo.sampleno, this.PatientInfo.sampledate);
                    var index = indexs.index1;
                    var index1 = indexs.index2;
                    this.tableDataListS[index] = this.PatientInfo;
                    this.tableDataList[index1] = this.PatientInfo;
                    this.OldPatientInfo = JSON.parse(JSON.stringify(this.PatientInfo));
                    //if (this.PRGNO == "LIS311") this.$refs.rmlabresult.QueryMed();
                    this.$refs.rmlabresult
                      .QueryResult(this.PatientInfo)
                      .then((ress) => {
                        setTimeout(() => {
                          this.AfterQResult(this.PatientInfo.reportid, this);
                          var row = this.$refs.xTableList.afterFullData.find((item) => item.reportid == this.PatientInfo.reportid);
                          for (var key in row) {
                            if (this.PatientInfo.hasOwnProperty(key)) {
                              row[key] = this.PatientInfo[key];
                            }
                          }
                          if (!ress.hasOwnProperty("res")) {
                            ress.res = res;
                            ress.redo = "";
                            ress.history = 0;
                          }
                          this.Patredoflag = !!ress.redo;
                          this.PatHistoryNum = ress.history;
                          var row = XE.clone(ress.res, true);
                          this.PatientInfo = this.PatientInfoGetname(row);
                          this.OldPatientInfo = this.PatientInfoGetname(row);
                          if (row) this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
                          this.specno = ress.sampleno ? ress.sampleno : this.specno;
                          if (row) {
                            if (!this.specno) this.specno = row.sampleno;
                            this.selectdate = row.sampledate;
                          } else if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) {
                            this.selectdate = this.sysdate + " 00:00:00";
                          }
                          if (this.prgno == "LIS311") this.$refs.rmlabresult.QueryMed();
                          // this.$refs.xTableList.setCurrentRow(this.PatientInfo).then(() => {
                          //     this.$refs.xTableList.scrollToRow(this.PatientInfo);
                          // });
                          //loading.close();
                          s();
                        }, 1);
                        // this.$refs.xTableList
                        //     .loadData(this.tableDataListS)
                        //     .then(() => {
                        //         setTimeout(() => {
                        //             this.AfterQResult(this.PatientInfo.reportid, this);
                        //             // this.$refs.xTableList.setCurrentRow(this.PatientInfo).then(() => {
                        //             //     this.$refs.xTableList.scrollToRow(this.PatientInfo);
                        //             // });
                        //             loading.close();
                        //             s();
                        //         }, 1);
                        //     })
                        //     .catch(() => {
                        //         //loading.close();
                        //         s();
                        //     });
                      })
                      .catch(() => {
                        //loading.close();
                        f();
                      });
                  }
                  this.changeflag = false;
                  this.$refs.rmlabresult.sheetchangflag = false;
                } else {
                  //loading.close();
                  this.$alert(res.Item2.errorMsg[0].content, res.Item2.errorMsg[0].title, {
                    confirmButtonText: "确定",
                  })
                    .then(() => {
                      f();
                    })
                    .catch(() => {
                      f();
                    });
                }
              })
              .catch(() => {
                //loading.close();
                f();
              });
          })
          .catch(() => {
            f();
          });
      });
    },
    // 页面刷新后
    AfterRefreshSetActive() {
      if (this.$refs.rmLabReportCollect.dialogCollectVisible) {//核收的时候就停在条码号上，哪也不去，不管选项设置
        this.$refs.rmLabReportCollect.$refs.collectbarcodeinput.focus();
      }
      else {
        switch (this.Options.focussampleno) {
          case "1":
            this.$refs.specno.select();
            break;
          case "2":
            setTimeout(() => {
              // 0.1秒以后等输入框完成获得焦点的动作,防止标本编号回车后同时触发病人信息第一行的回车事件导致光标不能正确停留在病人信息第一行
              this.$refs[this.ColData[0].col_code][0].select();
            }, 100);
            break;
          case "3":
            if (this.$refs.rmlabresult.tableDataResult && this.$refs.rmlabresult.tableDataResult.length > 0) {
              var row = this.$refs.rmlabresult.$refs.xTableResult.getData(0);
              this.$refs.rmlabresult.$refs.xTableResult.setCurrentRow(row).then(() => {
                this.$refs.rmlabresult.$refs.xTableResult.setActiveCell(row, "result_str");
                if (this.PRGNO == "LIS311") this.$refs.rmlabresult.QueryMed(row);
              });
            } else {
              this.$refs[this.ColData[0].col_code][0].select();
            }
            break;
          default:
            break;
        }
      }
    },
    //可修改判断
    UpdateJudge() {
      if (this.PatientInfo.rechkflag == "9" || (this.Options.onlymodifymyreport == "1" && this.$tool.getSession(this.$tool.loginuserno) != this.PatientInfo.report_user) || (this.PatientInfo.barcode && this.PatientInfo.barcode.indexOf("-退") > -1) || (this.PatientInfo.rechkflag == "1" && this.Options.canupdateaftersign != "1")) {
        return true;
      } else {
        return false;
      }
    },
    // 设置报告
    SetReportLooked(type) {
      if (!this.checkmodefous && this.Begincheckmode) {
        this.SaveReportandResult(0, this.selectdate, this.rptunitid).then(() => {
          var row = this.$refs.xTableList.getCurrentRow();
          if (type == 0) {
            this.$refs.xTableList.setSelection([row], false).then((res) => {
              this.SpecChangeActionList(0);
            });
          } else {
            this.$refs.xTableList.setSelection([row], true).then((res) => {
              this.SpecChangeActionList(1);
            });
          }
        });
      }
    },
    //按钮事件转换为方法
    ButtonSwitch(event) {
      switch (event) {
        case "btnUnCheck":
          return this.BeforeUnCheckReport(this.exactusernoreport);
        case "btnUnCheckUser":
          return this.UnCheckUser();
        case "btnBatchCheck":
          return this.BatchCheck();
        case "btnShowTodayDanger":
          return this.ShowTodayDanger();
        case "btnShowFloatButton":
          return this.ShowFloatButton();
        case "btnInputRechkDetail":
          return this.InputRechkDetail();
        case "btnOpenRechkNeed":
          return this.OpenRechkNeed();
        case "btnOpenImageFloat":
          return this.OpenImageFloat();
        case "btnOpenSampleImageFloat":
          return this.OpenSampleImageFloat();
        case "btnRePrintBarcode":
          return this.RePrintBarcode();
        case "btnQueryReportLog":
          return this.QueryReportLog();
        case "btnCheckPrint":
          return this.CheckPrint(2);
        case "btnQueryPatCase":
          return this.QueryPatCase();
        case "btnClearNoDoItems":
          return this.ClearNoDoItems();
        case "btnOpenLIS322":
          return this.OpenLIS322();
        case "btnOpenMerge":
          return this.OpenMerge();
        case "btnClearPrintFlag":
          return this.ClearPrintFlag();
        case "btnSetQcSample":
          return this.SetQcSample();
        case "btnOpenConfig":
          return this.OpenConfig();
        case "btnShowKnowledge":
          return this.ShowKnowledge();
        case "btnSendDual":
          return this.SendDual();
        case "btnSampleCancel":
          return this.SampleCancel();
        case "btnUnSign":
          return this.UnSignReport();
        case "btnUnReportUser":
          return this.UnReportUser();
        case "btnSeachMixBarcode":
          return this.SeachMixBarcode();
        case "btnBatNeedRechk": //批量标记需复查
          return this.BatNeedRechk();
        case "btnSetCheckMode": //进入审核模式
          return this.SetCheckMode(0);
        case "btnSetSignMode": //进入签名模式
          return this.SetCheckMode(1);
        case "btnUploadRpt": //报告数据导入
          return this.UploadRpt();
        case "btnInUsedSampleno": //查看已使用标本号
          return this.ShowInusedSampleno();
        case "btnOnDuty": //我值班
          return this.SaveDutyMan();
        case "btnAlertDanger": //上报/召回危急值
          return this.DangerDealForOneItem();
        case "btnEnOrDecry": //信息加密解密
          return this.PatientInfoEnOrDecry();
        case "btnVerifyCA": //验证ca签名
          return this.Getcasverifydata();
        case "btnChangeSampleno": //更改样本号
          return this.ChangeSampleno();
        case "btnQueryPhonenum": //常用电话
          return this.Queryphonenum();
        case "btnBatchInputSample": // 批量录入标本
          return this.BatchInputSample();
        case "btnUserDefineFunc1": // 用户自定义功能1
          return this.UserDefineFunction("btnUserDefineFunc1");
        case "btnUserDefineFunc2": // 用户自定义功能2
          return this.UserDefineFunction("btnUserDefineFunc2");
        case "btnUserDefineFunc3": // 用户自定义功能3
          return this.UserDefineFunction("btnUserDefineFunc3");
        case "btnUnDoDelete": // 撤销结果删除
          return this.UnDoDelete();
        case "btnSpecifyRedoResult":
          return this.SpecifyRedoResult();
        case "btnItemResultExport":
          return this.ItemResultExport();
      }
    },
    // #endregion 整体

    // #region 左侧
    // 查询当前报告单元对应左侧列表内容
    QueryCol(rptunitid) {
      return new Promise((s, f) => {
        if (!rptunitid) {
          rptunitid = this.rptunitid;
        }
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            data: {
              action: "queryinputcol",
              rptunitid: rptunitid,
            },
          })
          .then((res) => {
            if (res.Data) {
              this.tableDataColumn = res.Data;
              for (let i = 0; i < this.tableDataColumn.length; i++) {
                if (this.tableDataColumn[i].default_val != "") {
                  this.Queryddl("LIS3_" + this.tableDataColumn[i].col_code, "1");
                } else {
                  this.tableDataColumn[i].default_valname = "";
                }
              }

              this.ColData = [];
              this.ColTotalData = [];
              res.Data = res.Data.filter((item) => item.visibled == true);
              //因为新增了多行，所以要增加考虑计算多行的高度
              this.setAllColData(res.Data);
              s();
              this.$nextTick(() => {
                //this.$refs.barcode[0].focus();
                if (this.$refs.barcode && this.$refs.barcode[0]) {
                  this.$refs.barcode[0].select();
                }
              });
            }
          })
          .catch((error) => {
            f();
            this.$message.error("错误1:" + error);
          });
      });
    },
    // 把后台获取的每个字段根据条件塞进左侧列表
    setAllColData(data) {
      data = data.filter((item) => item.col_code != "emer_flag");
      //先取出当前高度最大容纳的行数
      let maxrowsnum = (this.$refs.xTableDiv.offsetHeight - 60) / 21;
      if (maxrowsnum <= 0) maxrowsnum = 24;
      //再根据每个字段的行高去填进每一列中
      let curnum = 0;
      let allinnum = 0;
      for (let col = 1; col <= 6; col++) {//为了提高性能这样写，反正一般加起来超过6列就过分了吧
        curnum = this.calcmaxcolsnum(allinnum, data, maxrowsnum);
        if (col == 1) this.ColData = data.slice(0, curnum);
        else this.ColTotalData.push(data.slice(allinnum, allinnum + curnum));
        allinnum += curnum;
        if (allinnum >= data.length) break;//全部塞完了就跳出
      }
    },
    // 计算左侧每列最大能塞个数
    calcmaxcolsnum(start, data, maxrowsnum) {
      let num = 0;//该列总计字段个数
      let curnum = 0;//当前列中已有行数
      for (let i = start; i < data.length; i++) {
        let item = data[i];
        if (curnum + item.rowheight <= maxrowsnum) {//如果已有行数+即将插入的字段行数不超过最大行数
          num++;
          curnum += item.rowheight;
        } else {
          break;
        }
      }
      return num;
    },
    // 查询通用数据列表
    Queryddl(colcode, type) {
      if (!colcode) colcode = this.popdatatype;
      if (this.InputCodeArr.filter((item) => item.key == colcode).length == 0) {
        this.$tool
          .request({
            url: "ucent/ddl",
            method: "post",
            data: {
              action: colcode,
              rptunitid: this.rptunitid,
            },
          })
          .then((res) => {
            if (!res.hasOwnProperty("errcode")) {
              this.InputCodeArr.push({ key: colcode, list: res });
              if (type) {
                var selitem = this.tableDataColumn.find((item) => item.col_code == colcode.replace("LIS3_", ""));
                if (selitem && res.Data) {
                  var valuename = res.Data.find((item) => item.hidkey == selitem.default_val);
                  if (valuename) selitem.default_valname = valuename.hidname;
                  else selitem.default_valname = selitem.default_val;
                }
              }
            }
          });
      } else {
        if (type) {
          var data = this.InputCodeArr.find((item) => item.key == colcode);
          var selitem = this.tableDataColumn.find((item) => item.col_code == colcode.replace("LIS3_", ""));
          if (selitem && data) {
            var valuename = data.list.Data.find((item) => item.hidkey == selitem.default_val);
            if (valuename) selitem.default_valname = valuename.hidname;
            else selitem.default_valname = selitem.default_val;
          }
        }
      }
    },
    // 根据报告单元获取检验意见、备用、文字描述列表
    QueryAdvice(infotype) {
      console.log("infotype", infotype);
      if (!infotype || infotype == "lab_advice") {
        infotype = "0";
        this.txtadvice = this.PatientInfo["lab_advice"];
        this.floatadvicetitle = "检验意见";
      } else if (infotype.indexOf("reserve") > -1) {
        var arr = ["A", "B", "C", "D", "E"];
        var index = infotype.replace("reserve", "");
        infotype = arr[index - 1];
        this.txtadvice = this.PatientInfo["reserve" + index];
        this.floatadvicetitle = "备用" + index;
      } else if (infotype.indexOf("txtinfo") > -1) {
        var arr = ["1", "2"];
        var index = infotype.replace("txtinfo", "");
        infotype = arr[index - 1];
        this.txtadvice = this.PatientInfo["txtinfo" + index];
        this.floatadvicetitle = "文字描述" + index;
      }
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "getrptunittxtinfo",
            rptunitid: this.rptunitid,
            infotype: infotype,
          },
        })
        .then((res) => {
          if (!res.hasOwnProperty("errcode")) {
            this.InputCodeArr.push({ key: this.popdatatype, list: res });
            this.tableDataAdviceAll = XE.clone(res, true);
            this.tableDataAdvice = res;
            //this.dialogAdvicefloatwindowVisible = true;
          }
        });
    },
    // 清除病人信息
    PatientInfoClear() {
      return new Promise((s, f) => {
        this.PatientInfo.barcode = null;
        this.PatientInfo.other_no = null;
        this.PatientInfo.pat_no = null;
        this.PatientInfo.pat_cardno = null;
        this.PatientInfo.inp_id = null;
        this.PatientInfo.inp_date = null;
        this.PatientInfo.pat_phone = null;
        this.PatientInfo.pat_id = null;
        this.PatientInfo.pat_name = null;
        this.PatientInfo.patname_py = null;
        this.PatientInfo.pat_sex = null;
        this.PatientInfo.pat_sexname = null;
        this.PatientInfo.pat_agestr = null;
        this.PatientInfo.pat_ageyear = null;
        this.PatientInfo.pat_birth = null;
        this.PatientInfo.charge_typeno = null;
        this.PatientInfo.charge_typenoname = null;
        this.PatientInfo.pat_diag = null;
        this.PatientInfo.pat_diag_icd = null;
        this.PatientInfo.req_docno = null;
        this.PatientInfo.sampled_user = null;
        this.PatientInfo.req_docnoname = null;
        this.PatientInfo.req_deptno = null;
        this.PatientInfo.req_deptnoname = null;
        this.PatientInfo.req_wardno = null;
        this.PatientInfo.req_wardnoname = null;
        this.PatientInfo.req_bedno = null;
        this.PatientInfo.pat_height = null;
        this.PatientInfo.weight = null;
        this.PatientInfo.abo_bldtype = null;
        this.PatientInfo.rh_bldtype = null;
        this.PatientInfo.specimen_comm = null;
        this.PatientInfo.encrypt_flag = "0";
        this.PatientInfo.encrypt_user = null;
        this.PatientInfo.req_dt = null;
        this.PatientInfo.sampled_dt = null;
        this.PatientInfo.recieve_dt = null;
        this.PatientInfo.report_dt = null;
        this.PatientInfo.stat_flag = "1";
        this.PatientInfo.emer_flag = "0";
        this.PatientInfo.pat_othno1 = null;
        this.PatientInfo.pat_othno2 = null;
        this.PatientInfo.pat_othno3 = null;
        this.PatientInfo.custom1 = null;
        this.PatientInfo.custom2 = null;
        this.PatientInfo.custom3 = null;
        this.PatientInfo.custom4 = null;
        this.PatientInfo.custom5 = null;
        this.PatientInfo.custom6 = null;
        this.PatientInfo.custom7 = null;
        this.PatientInfo.custom8 = null;
        this.PatientInfo.custom9 = null;
        this.PatientInfo.custom10 = null;
        if (this.$refs.xTableList.tableFullData.filter((item) => item.sampleno == this.specno && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid).length > 0) {
          var index = this.$refs.xTableList.getRowIndex(this.$refs.xTableList.getCurrentRow());
          this.$refs.xTableList.tableFullData[index] = this.PatientInfo;
        }
        if (this.$refs.rmlabresult.tableDataResult) {
          let tmp = this.$refs.rmlabresult.tableDataResult.filter((t) => t.result_str != "未做" && t.result_str != "已上机" && (t.result_str != "" || t.result1 != "" || t.result_txt != ""));
          this.$refs.rmlabresult.tableDataResult = tmp;
        }
        s();
      });
    },
    // 初始化病人信息
    InitPatientInfo(watchtype) {
      let nowatchflag = false;
      //切换报告初始化病人信息时不进行监视
      if (watchtype && watchtype == "changereportinit") nowatchflag = true;
      this.PatientInfo = { rptunitid: this.rptunitid, specimen_codename: "", specimen_code: "", pat_typecodename: "", pat_typecode: "", pat_sexname: "", pat_sex: "", req_deptnoname: "", req_deptno: "", req_wardnoname: "", req_wardno: "", req_docnoname: "", req_docno: "", lab_advice: "", report_commname: "", report_comm: "", specimen_commname: "", specimen_comm: "", charge_typenoname: "", charge_typeno: "", barcode: "", pat_name: "", pat_agestr: "", req_bedno: "", pat_diag: "", pat_diag_icd: "", req_reason: "", pat_phone: "", pat_no: "", sampledate: this.selectdate, sampleno: this.specno, pat_hospcode: "", pat_hospcodename: "", markno: "", marknoname: "", emer_flag: "0", txtinfo1: "", txtinfo2: "", report_user: "", report_username: "", rechk_user: "", rechk_username: "", pat_cardno: "", other_no: "", inp_id: "", inp_date: "", pat_id: "", patname_py: "", pat_birth: "", pat_height: "", weight: "", abo_bldtype: "", rh_bldtype: "", pat_idcardno: "", reserve1: "", reserve2: "", reserve3: "", reserve4: "", reserve5: "", markreason: "", markreasonpass: "", tat_comm: "", tat_commname: "", pat_othno1: "", pat_othno2: "", pat_othno3: "", custom1: "", custom2: "", custom3: "", custom4: "", custom5: "", custom6: "", custom7: "", custom8: "", custom9: "", custom10: "", sampled_user: "", sampled_username: "", nowatchflag: nowatchflag };
      this.OldPatientInfo = { rptunitid: this.rptunitid, specimen_codename: "", specimen_code: "", pat_typecodename: "", pat_typecode: "", pat_sexname: "", pat_sex: "", req_deptnoname: "", req_deptno: "", req_wardnoname: "", req_wardno: "", req_docnoname: "", req_docno: "", lab_advice: "", report_commname: "", report_comm: "", specimen_commname: "", specimen_comm: "", charge_typenoname: "", charge_typeno: "", barcode: "", pat_name: "", pat_agestr: "", req_bedno: "", pat_diag: "", pat_diag_icd: "", req_reason: "", pat_phone: "", pat_no: "", sampledate: this.selectdate, sampleno: this.specno, pat_hospcode: "", pat_hospcodename: "", markno: "", marknoname: "", emer_flag: "0", txtinfo1: "", txtinfo2: "", report_user: "", report_username: "", rechk_user: "", rechk_username: "", pat_cardno: "", other_no: "", inp_id: "", inp_date: "", pat_id: "", patname_py: "", pat_birth: "", pat_height: "", weight: "", abo_bldtype: "", rh_bldtype: "", pat_idcardno: "", reserve1: "", reserve2: "", reserve3: "", reserve4: "", reserve5: "", markreason: "", markreasonpass: "", tat_comm: "", tat_commname: "", pat_othno1: "", pat_othno2: "", pat_othno3: "", custom1: "", custom2: "", custom3: "", custom4: "", custom5: "", custom6: "", custom7: "", custom8: "", custom9: "", custom10: "", sampled_user: "", sampled_username: "", nowatchflag: nowatchflag };
      for (let i = 0; i < this.ColData.length; i++) {
        if (this.ColData[i].col_code == "sampleno") continue;
        if (this.ColData[i].col_code == "rptunitid") continue;
        if (this.ColData[i].col_code == "reportid") continue;
        if (this.ColData[i].valuetype != 5) {
          if (this.ColData[i].default_val) {
            this.PatientInfo[this.ColData[i].col_code] = this.ColData[i].default_val;
            this.OldPatientInfo[this.ColData[i].col_code] = this.ColData[i].default_val;
          } else {
            this.PatientInfo[this.ColData[i].col_code] = "";
            this.OldPatientInfo[this.ColData[i].col_code] = "";
          }
        } else {
          if (this.ColData[i].default_val) {
            this.PatientInfo[this.ColData[i].col_code + "name"] = this.ColData[i].default_valname;
            this.OldPatientInfo[this.ColData[i].col_code + "name"] = this.ColData[i].default_valname;
            this.PatientInfo[this.ColData[i].col_code] = this.ColData[i].default_val;
            this.OldPatientInfo[this.ColData[i].col_code] = this.ColData[i].default_val;
          } else {
            this.PatientInfo[this.ColData[i].col_code + "name"] = "";
            this.OldPatientInfo[this.ColData[i].col_code + "name"] = "";
          }
        }
      }
      this.oldbarcode = "";
    },
    //queryresult之后加载病人信息，如果patientInfo为空则返回initPATIENTIFNO()
    PatientInfoGetname(patientInfo) {
      if (patientInfo) {
        var info = patientInfo;
        var specialcol = this.ColData.filter((item) => item.valuetype == "5");
        var specialcoltotal = this.ColTotalData.filter((item) => item.valuetype == "5" && item.col_code != "pat_agestr");
        for (let i = 0; i < specialcol.length; i++) {
          if (!info[specialcol[i].col_code + "name"]) info[specialcol[i].col_code + "name"] = info[specialcol[i].col_code] ? info[specialcol[i].col_code] : "" + "";
        }
        for (let i = 0; i < specialcoltotal.length; i++) {
          if (!info[specialcoltotal[i].col_code + "name"]) info[specialcoltotal[i].col_code + "name"] = info[specialcoltotal[i].col_code] ? info[specialcol[i].col_code] : "" + "";
        }
        return info;
      } else {
        this.InitPatientInfo();
        var info = this.PatientInfo;
        var specialcol = this.ColData.filter((item) => item.valuetype == "5");
        var specialcoltotal = this.ColTotalData.filter((item) => item.valuetype == "5" && item.col_code != "pat_agestr");
        for (let i = 0; i < specialcol.length; i++) {
          if (!info[specialcol[i].col_code + "name"]) info[specialcol[i].col_code + "name"] = info[specialcol[i].col_code] ? info[specialcol[i].col_code] : "" + "";
        }
        for (let i = 0; i < specialcoltotal.length; i++) {
          if (!info[specialcoltotal[i].col_code + "name"]) info[specialcoltotal[i].col_code + "name"] = info[specialcoltotal[i].col_code] ? info[specialcol[i].col_code] : "" + "";
        }
        return info;
      }
    },
    // 比较病人信息看是否更新了
    ComparePatientInfo() {
      var execption = false;
      //没有报告ID的时候就不比较
      // if(!this.PatientInfo.reportid) {
      //     this.$pub.Log("比较不同时发现报告ID无效");
      //     return true;
      // }
      if (this.PatientInfo.rechkflag == "9") {
        return true;
      }
      for (var pKey in this.PatientInfo) {
        if (pKey !== "sampledate" && pKey != "rptunitid" && pKey != "rechk_dt" && pKey != "rechk_dt" && pKey != "_XID" && pKey != "specialtype") {
          if (!this.OldPatientInfo.hasOwnProperty(pKey) && this.PatientInfo[pKey] != "") {
            this.$pub.Log("比较旧包含不同:报告id" + this.PatientInfo.reportid + ":字段:" + pKey);
            execption = true;
          }
          if (this.PatientInfo[pKey] != this.OldPatientInfo[pKey]) {
            this.$pub.Log("比较不同:报告id" + this.PatientInfo.reportid + ":字段:" + pKey);
            this.$pub.Log("比较不同:报告id" + this.PatientInfo.reportid + ":字段比较:new:" + this.PatientInfo[pKey] + " old:" + this.OldPatientInfo[pKey]);
            execption = true;
            break;
          }
        }
      }
      if (this.ImageDiff) {
        execption = true;
        //if(PatientInfo['rechkflag'] == '9') execption=false;
        //if(Options.onlymodifymyreport == '1' && $tool.getSession(this.$tool.loginuserno) !=PatientInfo['report_user']) execption=false;
        this.$pub.Log("比较图像不同:报告id" + this.PatientInfo.reportid);
      }
      var datas = this.$refs.rmlabresult.$refs.xTableResult.getRecordset();
      if (this.Options.doubleresultcol == 1) {
        var result1 = this.$refs.rmlabresult.$refs.xTableResult1.getRecordset();
        datas.updateRecords = datas.updateRecords.concat(result1.updateRecords);
        datas.insertRecords = datas.insertRecords.concat(result1.insertRecords);
        datas.removeRecords = datas.removeRecords.concat(result1.removeRecords);
      }
      if (this.PRGNO == "LIS311") {
        var datasm = this.$refs.rmlabresult.$refs.xTableMed.getRecordset();
        if (!execption && datasm.insertRecords.length == 0 && datasm.removeRecords.length == 0 && datasm.updateRecords.length == 0 && datas.insertRecords.length == 0 && datas.removeRecords.length == 0 && datas.updateRecords.length == 0 && !this.changeflag && !this.$refs.rmlabresult.sheetchangflag) return true;
        else return false;
      } else if (this.PRGNO == "LIS313") {
        if (this.$refs.rmlabresult.$refs.xTableResult2) {
          var result2 = this.$refs.rmlabresult.$refs.xTableResult2.getRecordset();
          datas.updateRecords = datas.updateRecords.concat(result2.updateRecords);
          datas.insertRecords = datas.insertRecords.concat(result2.insertRecords);
          datas.removeRecords = datas.removeRecords.concat(result2.removeRecords);
        }
        //骨髓修改逻辑判断 因为无法获取到最新 分析/特征和结论 所以单独判断一下
        var txtinfo1 = this.$refs.rmlabresult.txtinfo1;
        var txtinfo2 = this.$refs.rmlabresult.txtinfo2;
        if (!execption && datas.insertRecords.length == 0 && datas.removeRecords.length == 0 && datas.updateRecords.length == 0 && this.PatientInfo.txtinfo2 == txtinfo2 && this.PatientInfo.txtinfo1 == txtinfo1) return true;
        else return false;
      } else {
        if (!execption && datas.insertRecords.length == 0 && datas.removeRecords.length == 0 && datas.updateRecords.length == 0) return true;
        else return false;
      }
    },
    // 病人信息默认值加载
    PatientInfoDefVal(Patientinfo) {
      for (let i = 0; i < this.tableDataColumn.length; i++) {
        var property = this.tableDataColumn[i].col_code;
        var value = this.tableDataColumn[i].default_val;
        if (!Patientinfo[property] && value) {
          if (this.tableDataColumn[i].valuetype == "5") {
            Patientinfo[property] = value;
            Patientinfo[property + "name"] = this.tableDataColumn[i].default_valname;
            this.OldPatientInfo[property] = value;
            this.OldPatientInfo[property + "name"] = this.tableDataColumn[i].default_valname;
          } else {
            Patientinfo[property] = value;
            this.OldPatientInfo[property] = value;
          }
        } else if (property == "hospcode" && value && value != "All") {
          //送检单位比较特殊，他在报告表中有默认值All,所以肯定不从上面走，我们单独写下
          if (Patientinfo[property] == "All" || Patientinfo[property] == "") {
            Patientinfo[property] = value;
            Patientinfo[property + "name"] = this.tableDataColumn[i].default_valname;
          }
        }
      }
    },
    // #endregion 左侧

    // #region 中间
    // 查询到结果之后进行赋值
    AfterQResult(reportid, that) {
      var rptcode = "";
      if (that.$refs.rmlabresult.tableDataResult && that.$refs.rmlabresult.tableDataResult.length > 0) {
        if (that.$refs.rmlabresult.showmedrptitemcode) {
          var row = that.$refs.rmlabresult.$refs.xTableResult.afterFullData.find((item) => item.rpt_itemcode == that.$refs.rmlabresult.showmedrptitemcode);
          if (row) {
            that.$refs.rmlabresult.$refs.xTableResult.setCurrentRow(row);
            rptcode = that.$refs.rmlabresult.showmedrptitemcode;
            that.$refs.rmlabresult.tempRptItem = row;
          }
        } else {
          that.$refs.rmlabresult.$refs.xTableResult.setCurrentRow(that.$refs.rmlabresult.$refs.xTableResult.afterFullData[0]);
          rptcode = that.$refs.rmlabresult.tableDataResult[0].rpt_itemcode;
          that.$refs.rmlabresult.tempRptItem = that.$refs.rmlabresult.$refs.xTableResult.afterFullData[0];
        }

      } else {
        that.$refs.rmlabresult.tempRptItem = { reportid: "", rpt_itemcode: "", rpt_itemname: "", result_str: "", result_txt: "" };
      }
      if (that.PRGNO == "LIS311") {
        that.$refs.rmlabresult.MedTotalData = [];
        that.$refs.rmlabresult.tableDataMed = [];
        //Mod by yangl 2021-03-22  修正切换右侧行时，没有查询药敏结果的BUG
        that.$refs.rmlabresult.QueryMed(null, rptcode, reportid);
      }
    },
    //查找关注项目检验结果和历史结果
    queryConcernItem(reportid) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryconcernitem",
            rptunitid: this.rptunitid,
            reportid: reportid,
          },
        })
        .then((res) => {
          if (!res.hasOwnProperty("errcode")) {
            if (res.dt && res.dt.length > 0) {
              this.showConcernItemData = res.dt;
              this.showConcernItemVisible = true;
            }
          } else {
            this.$alert(res.errmsg, "错误");
          }
        });
    },
    // #endregion 中间

    // #region 右侧
    // 根据条码有无来判断是新增报告
    GetBarcodeHasVal(row) {
      if (row && row.hasOwnProperty("barcode")) {
        //条码号为空时判定该报告无条码
        if (row.barcode == null || row.barcode == "") {
          this.SpecAddflag = 1;
          this.barcodeinputsuccessflag = false;
        } else {
          this.SpecAddflag = 0;
        }
      } else {
        this.SpecAddflag = 1;
        this.barcodeinputsuccessflag = false;
      }
    },
    // 根据列表切换标本
    SpecnoExchangeByList(value) {
      this.SaveReportandResult(0, this.selectdate, this.rptunitid).then((r) => {
        //清空一下病人信息和结果，防止有的时候反应慢，切换速度跟不上容易看错
        if (this.Options.switchreportreload == "1") {
          this.InitPatientInfo("changereportinit");
          this.$refs.rmlabresult.tableDataResult = [];
          if (this.Options.doubleresultcol == "1") this.$refs.rmlabresult.tableDataResult1 = [];
          //如果历史结果tab开着，也要清空一下
          if (this.tabvalue == "3") {
            this.HistoryLeftList = [];
            this.HistoryLeftAllList = [];
            this.tableDataHistory = [];
            this.tableDataHistoryMed = [];
          }
        }
        this.SpecChangeActionList(value);
      });
    },
    // 样本号列表切换
    SpecChangeActionList(value) {
      var specstr = this.specno + "";
      var reg = new RegExp("\\d+(?=[^0-9]*$)", "g");
      var regarr = specstr.match(reg); // 获取当前行详细
      if (value > 0) {
        var row = this.$refs.xTableList.getCurrentRow();
        var tempindex = this.$refs.xTableList.afterFullData.indexOf(row);
        if (tempindex < this.$refs.xTableList.afterFullData.length - 1) {
          var tempdata = this.$refs.xTableList.afterFullData[tempindex + 1];
          this.SetInfoByRow(tempdata, tempdata.sampleno).then(() => {
            this.ChangeAsTab();
            this.AfterRefreshSetActive();
          });
          // this.$refs.rmlabresult
          //     .QueryResult(tempdata)
          //     .then(res => {
          //         if (!res.hasOwnProperty("res")) {
          //             res.res = res;
          //             res.redo = "";
          //             res.history = 0;
          //         }
          //         this.Patredoflag = !!res.redo;
          //         this.PatHistoryNum = res.history;
          //         var row = XE.clone(res.res, true);
          //         this.$refs.xTableList.setCurrentRow(tempdata).then(() => {
          //             this.$refs.xTableList.scrollToRow(tempdata);
          //         });
          //         this.PatientInfo = this.PatientInfoGetname(row);
          //         this.OldPatientInfo = this.PatientInfoGetname(row);
          //         this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
          //         this.AfterQResult(row.reportid, this);
          //         //var listrow = this.$refs.xTableList.afterFullData.filter((item) => item.reportid == row.reportid)[0];
          //         if (row) {
          //             this.specno = row.sampleno;
          //             this.selectdate = row.sampledate;
          //         } else if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) {
          //             this.selectdate = this.sysdate + " 00:00:00";
          //         }
          //         this.ChangeAsTab();
          //         this.$pub.Log("下一个查询结束:" + this.PatientInfo.reportid);
          //         this.checkingflag = false;
          //     })
          //     .catch(() => {
          //         this.ChangeAsTab();
          //     });
          // 选择了我的报告或本组报告时报告单元ID与标本日期会随着报告的切换而改变
          this.rptunitid = tempdata.rptunitid;
          this.sampledate = tempdata.sampledate;
          this.specno = tempdata.sampleno;
          this.tempRowIndex = this.$refs.xTableList.getRowIndex(tempdata);
        } else {
          if (this.Begincheckmode) return;
          this.SpecChangeAction(1, 0);
        }
      } else {
        var row = this.$refs.xTableList.getCurrentRow();
        var tempindex = this.$refs.xTableList.afterFullData.indexOf(row);
        if (tempindex > 0) {
          var tempdata = this.$refs.xTableList.afterFullData[tempindex - 1];
          this.SetInfoByRow(tempdata, tempdata.sampleno).then(() => {
            this.ChangeAsTab();
            this.AfterRefreshSetActive();
          });
          // this.$refs.rmlabresult
          //     .QueryResult(tempdata)
          //     .then(res => {
          //         if (!res.hasOwnProperty("res")) {
          //             res.res = res;
          //             res.redo = "";
          //             res.history = 0;
          //         }
          //         this.Patredoflag = !!res.redo;
          //         this.PatHistoryNum = res.history;
          //         var row = XE.clone(res.res, true);
          //         this.$refs.xTableList.setCurrentRow(tempdata).then(() => {
          //             this.$refs.xTableList.scrollToRow(tempdata);
          //         });
          //         this.PatientInfo = this.PatientInfoGetname(row);
          //         this.OldPatientInfo = this.PatientInfoGetname(row);
          //         this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
          //         this.AfterQResult(row.reportid, this);
          //         //var listrow = this.$refs.xTableList.afterFullData.filter((item) => item.reportid == row.reportid)[0];
          //         if (row) {
          //             this.specno = row.sampleno;
          //             this.selectdate = row.sampledate;
          //         } else if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) {
          //             this.selectdate = this.sysdate + " 00:00:00";
          //         }
          //         this.ChangeAsTab();
          //     })
          //     .catch(() => {
          //         this.ChangeAsTab();
          //     });
          // 选择了我的报告或本组报告时报告单元ID与标本日期会随着报告的切换而改变
          this.rptunitid = tempdata.rptunitid;
          this.sampledate = tempdata.sampledate;
          this.specno = tempdata.sampleno;
          this.tempRowIndex = this.$refs.xTableList.getRowIndex(tempdata);
        } else {
          this.ChangeAsTab();
          //this.SpecChangeAction(0, 0);
        }
      }
    },
    // 获取报告标记
    Queryreportmark(row) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryreportmark",
            reportid: row.reportid,
          },
        })
        .then((res) => {
          if (res.hasOwnProperty("flag") && res.flag == "1") {
            if (res.patinfo && res.patinfo.length > 0) {
              this.mspecialflag = res.patinfo[res.patinfo.length - 1].specialtype;
              this.specialtypena = res.pattypemark;
              var namepat = this.specialpattypes.find((item) => item.specialtype == this.mspecialflag);
              this.mspecialflagname = namepat ? namepat.specialtypename : "";
              this.tableDataListS.forEach(item => {
                if (item.reportid == row.reportid) {
                  item.special_flag = res.pattypemark;
                  item.special_color = res.pattypecolor;
                }
              });
            } else {
              this.mspecialflag = "";
              this.mspecialflagname = "";
              this.specialtypena = "";
              this.tableDataListS.forEach(item => {
                if (item.reportid == row.reportid) {
                  item.special_flag = "";
                  item.special_color = "";
                }
              });
            }
            if (res.markno) {
              row.markno = res.markno;
              this.mmarkflag = res.markno;
            } else {
              row.markno = "";
              this.mmarkflag = "";
            }
          }
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    Querymultiitemdetail(row) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "getmultiitemdetail",
            reportid: row.reportid,
          },
        })
        .then((res) => {
          this.multiitemData = res.detailData;
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    // 报告切换时右侧tab页信息也跟着切换
    ChangeAsTab() {
      if (this.dialogimgfloatwindowVisible) this.QueryImage();
      if (this.dialogsampleimgfloatwindowVisible) this.QuerySampleImage();
      switch (this.curtabindex) {
        case 2:
          if (!this.dialogimgfloatwindowVisible) {
            this.QueryImage();
          }
          break;
        case 3:
          this.QueryHistory();
          break;
        case 4:
          this.QueryInputMdl();
          break;
        case 5:
          this.QueryApply();
          this.QueryApplyItem();
          break;
        case 6:
          this.QueryRechk();
          break;
        case 7:
          this.QueryCommunite();
          break;
        case 10:
          this.QueryInstrData();
          break;
        case 12:
          if (!this.dialogsampleimgfloatwindowVisible) {
            this.QuerySampleImage();
          }
          break;
        case 16:
          this.QueryAlteritemData();
          break;
        case 24:
          this.QuerymixDetail();
          break;
        case 25:
          this.QueryReportLog('tab');
          break;
      }
    },
    // 获取列表中报告位置
    GetRowIndex(specno, sampledate) {
      var row = this.tableDataListS.filter((item) => item.sampleno == specno && item.sampledate == sampledate && item.rptunitid == this.rptunitid);
      var row1 = this.tableDataList.filter((item) => item.sampleno == specno && item.sampledate == sampledate && item.rptunitid == this.rptunitid);
      var dealrow = this.PatientInfo;
      var dealrow1 = XE.clone(this.PatientInfo, true);
      if (row.length > 0 || row1.length > 0) {
        dealrow = row[0];
        dealrow1 = row1[0];
      }
      var index = this.tableDataListS.indexOf(dealrow);
      var index1 = this.tableDataList.indexOf(dealrow1);
      return { index1: index, index2: index1 };
    },
    //计算报告数量
    CalcNum(data) {
      if (data) this.TotalPatNum = data.length;
      else this.TotalPatNum = 0;
      let unexnum = 0;
      let exnum = 0;
      let needredonum = 0;
      let hasredonum = 0;
      let hasovertimenum = 0;
      for (let i = 0; i < this.TotalPatNum; i++) {
        if (data[i].rechkflag == "9") exnum++;
        else unexnum++;
        if (data[i].redo_flag == "1") needredonum++;
        else if (data[i].redo_flag == "2") hasredonum++;
        if (data[i].overtimeflag == "1") hasovertimenum++
      }
      this.ExactNum = exnum;
      this.UnExactNum = unexnum;
      this.NeedRedoNum = needredonum;
      this.HasRedoNum = hasredonum;
      this.HasOverTimeNum = hasovertimenum;
      let that = this;
      setTimeout(() => {
        var index = that.$refs.xTableList.afterFullData.findIndex((item) => item.sampleno == that.specno && item.sampledate == that.selectdate && item.rptunitid == that.rptunitid);
        that.NowPatNum = index + 1;
      }, 1);
    },
    // #endregion 右侧

    // #region 上方
    // 根据报告单元选项【标本号超出长度唯一】获取样本日期范围
    JudgeSampleDate(samplenouniquelen) {
      var date = new Date(this.selectdate);
      if (samplenouniquelen == -1) {
        var year = date.getFullYear();
        var yearstart = year + "-01-01";
        var yearend = year + 1 + "-01-01";
        return { start: yearstart, end: yearend };
      } else if (samplenouniquelen == -2) {
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var monthstart = year + "-" + (month < 10 ? "0" + month : month) + "-01";
        var monthend = year + "-" + (month < 9 ? "0" + (month + 1) : month + 1) + "-01";
        if (month == 12) {
          monthend = year + 1 + "-01-01";
        }
        return { start: monthstart, end: monthend };
      } else if (samplenouniquelen == -3) {
        var day = date.getDay();
        var daystart = "";
        var dayend = "";
        if (day == 0) {
          var datetime = date.getTime() - 3600 * 1000 * 24 * 6;
          var dates = new Date(datetime);
          daystart = XE.toDateString(dates, "yyyy-MM-dd");
          dayend = XE.toDateString(date, "yyyy-MM-dd");
        } else {
          var datetimes = date.getTime() - 3600 * 1000 * 24 * (day - 1);
          var datetimee = date.getTime() + 3600 * 1000 * 24 * (7 - day);
          daystart = XE.toDateString(datetimes, "yyyy-MM-dd");
          dayend = XE.toDateString(datetimee, "yyyy-MM-dd");
        }
        return { start: daystart, end: dayend };
      } else {
        return { start: "1900-01-01", end: "2100-01-01" };
      }
    },
    // 获取可从标本编号输入的报告单元
    GetSpecnoInputRptunit() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "initinfo",
            prgno: this.PRGNO,
          },
        })
        .then((res) => {
          this.specnoinputrptunit = res.specnoinputrptunit;
        });
    },
    // 获取默认报告单元
    GetDefRptUnit() {
      this.pageinitloading = true;
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "initinfo",
            prgno: this.PRGNO,
          },
        })
        .then((res) => {
          var multirpt = "0";
          var rptunitids = "";
          var nextpath = "";
          if (this.lis310multiple == "1") {
            var pageinfo = this.$tool.getSession("RptPageInfo");
            var pagearr = JSON.parse(pageinfo);
            if (pagearr == null) pagearr = [];
            if (res.defaultmultirptunitids != "") {
              var rptunitids = res.defaultmultirptunitids.split(",");
              for (let i = 0; i < rptunitids.length; i++) {
                pagearr.push({ id: this.$route.query.id - 0 + i, rptunitid: rptunitids[i], path: "/" + this.PRGNO + "?id=" + (this.$route.query.id - 0 + i), multi: res.defaultmultirptunitids });
              }
              this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
              this.$pub.lis310id = this.$route.query.id - 0 + rptunitids.length - 1;

              this.rptunitid = rptunitids[0] - 0;
              if (rptunitids.length > 1) {
                var id = this.$route.query.id - 0;
                var rouindex = 1;
                var path = this.PRGNO + "?id=" + (id + rouindex);
                nextpath = path;
                // this.$router.push({ path: path });
              }
            } else {
              this.rptunitid = res.defrptunitid;
              pagearr.push({ id: this.$route.query.id, rptunitid: res.defrptunitid, path: "/" + this.PRGNO + "?id=" + this.$route.query.id, multi: "" });
              this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
            }

            //multirpt = "1";
          } else {
            this.rptunitid = res.defrptunitid;
            multirpt = "0";
          }
          //this.ListKey = this.PRGNO + "_ListTable_" + this.rptunitid;
          //this.rpttableid = this.rptunitid + "";
          //this.rptunitid = res.defrptunitid;
          if (this.rptunitid == 0) {
            this.$pub.Log("未获取到默认报告单元!");
            this.$emit("initError");
            this.pageinitloading = false;
          } else {
            this.oldrptunitid = this.rptunitid;
            this.GetOptions(this.rptunitid, multirpt, res.defaultmultirptunitids)
              .then(() => {
                this.pageinitloading = false;
                if (this.sysdate == "") {
                  this.sysdate = this.Options.sysdate;
                  this.selectdate = this.sysdate + " 00:00:00";
                } else {
                  this.selectdate = this.sysdate + " 00:00:00";
                }

                this.QueryCol().then(() => {
                  this.QueryList(1).then(() => {
                    if (nextpath) {
                      this.$router.push({ path: nextpath });
                    }
                  });
                });
              })
              .catch(() => {
                this.$pub.Log("未获取到报告单元对应选项!");
                this.pageinitloading = false;
              });
          }

          //this.pageinitloading = true;
        });
    },
    //加载默认按钮配置
    InitButton() {
      var buttonitem = localStorage.getItem("REPORT_BUTTONFLOAT");
      var buttonarr = [];
      if (buttonitem) {
        buttonarr = buttonitem.split(",");
      }
      var ButtonAll = [];
      if (buttonarr.length > 0) {
        for (let i = 0; i < buttonarr.length; i++) {
          var onerow = this.ButtonListAll.filter((item) => item.field == buttonarr[i]);
          if (onerow.length > 0) {
            ButtonAll.push(onerow[0]);
            onerow[0].visible = "1";
          }
        }
      } else {
        for (let i = 0; i < this.ButtonListAll.length; i++) {
          if (this.ButtonListAll[i].field <= 3) {
            this.ButtonListAll[i].visible = "1";
            ButtonAll.push(this.ButtonListAll[i]);
          }
        }
      }
      this.ButtonList = ButtonAll;
    },
    // 获取当前用户权限内报告单元列表
    GetRoleRptunit() {
      this.$tool
        .request({
          url: "ucent/ddl",
          method: "post",
          data: {
            action: "rptunit",
            prgno: this.PRGNO,
          }
        })
        .then(res => {
          this.rolerptunitlist = res.RData.Data;
        })
        .catch(e => {
          console.log("erro", e);
        });
    },
    //报告单元基本色：10进制转16进制
    ColorChange(color) {
      if (color != null) {
        var tempcolor = color.toString(16);
        var num = 6 - tempcolor.length;
        var result = tempcolor;
        if (num > 0) {
          for (let i = 0; i < num; i++) {
            result = "0" + result;
          }
        }
        var resultarr = result.split("");
        var r1 = resultarr[0];
        var r2 = resultarr[1];
        resultarr[0] = resultarr[4];
        resultarr[1] = resultarr[5];
        resultarr[4] = r1;
        resultarr[5] = r2;
        result = resultarr.join("");
        return result;
      } else {
        return "";
      }
    },
    // #endregion 上方

    // #endregion 页面相关

    // #region 其他
    // 0点提示换日期
    NextDayAlert() {
      this.$confirm("夜班辛苦了，开始新一天的工作。<br/>是否切换至新一天的标本日期？", "提示", {
        confirmButtonText: "是",
        cancelButtonText: "否",
        focusConfirmButton: true,
        closeOnClickModal: false,
        dangerouslyUseHTMLString: true,
        type: "warning",
      })
        .then(() => {
          this.SaveReportandResult(1, this.selectdate, this.rptunitid)
            .then(() => {
              this.selectdate = XE.toDateString(this.sysdate, "yyyy-MM-dd 00:00:00");
              //如果核收页面也开着，核收也一起变
              if (this.$refs.rmLabReportCollect.dialogCollectVisible) {
                this.$refs.rmLabReportCollect.collectselectdate = this.selectdate;
              }
              this.tabvalue = "1";
              this.QueryList(2);
            })
            .catch((err) => {
              console.log(err);
            });

        })
        .catch(() => { });
    },
    // 关闭右键菜单
    closeMenu(e) {
      this.RightMenuShow = false;
      //if (this.$refs.rmlabresult.hasOwnProperty("textvalueshow")) this.$refs.rmlabresult.textvalueshow = false;
    },
    // 通用弹窗改变值
    popchange(c, v, row) {
      if (this.Options.inputasreportuser != "1") {
        this.PatientInfo.report_username = this.exactusernamereport;
        this.PatientInfo.report_user = this.exactusernoreport;
      }
      if (this.popdatatype != "LIS3_report_user" && this.popdatatype != "LIS3_rechk_user") {
        if (this.popdatatype == "LIS3_pat_diag") {
          this.PatientInfo["pat_diag"] = v;
          this.PatientInfo["pat_diagname"] = v;
          this.PatientInfo["pat_diag_icd"] = c;
          this.dialogTableVisible = false;
          this.$refs["pat_diag"][0].select();
        } else {
          var colcode = this.popdatatype.replace("LIS3_", "");
          this.PatientInfo[colcode] = c;
          this.PatientInfo[colcode + "name"] = v;
          this.dialogTableVisible = false;
          this.$refs[colcode][0].select();
        }
      } else {
        this.usercode = c;
        this.username = v;
        this.userpwd = "";
        this.dialogLoginVisible = true;
        this.dialogTableVisible = false;
      }
    },
    //弹出框关闭时自动保存
    popcommonclose() {
      var typecol = (this.popdatatype + "").replace("LIS3_", "");
      if (this.$refs[typecol]) {
        this.$refs[typecol][0].select();
      }
      if (typecol == "specimen_code") {
        var value = this.PatientInfo.specimen_codename;
        var list = this.InputCodeArr.filter((item) => item.key == this.popdatatype);
        var row = list[0].list.Data.filter((item) => (item.inputcode + "").toUpperCase() == (value + "").toUpperCase() || (item.hidkey + "").toUpperCase() == (value + "").toUpperCase() || item.hidname.toUpperCase() == value.toUpperCase());
        if (row.length == 0) {
          this.PatientInfo.specimen_codename = "";
          this.PatientInfo.specimen_code = "";
        }
      }
    },
    // 后台返回错误处理
    ErrorListDeal(msg, flag, type, func) {
      return new Promise((s, f) => {
        //msg消息列表
        //flag返回值标志
        //func确定后执行的函数
        //type为0是普通，type为1是危急值上报弹窗
        this.InputMsg = [];

        // 错误消息也使用消息列表回看

        // if (flag == -1) {
        //     //错误消息
        //     //if (msg.errorMsg.length > 0) {
        //     this.ErrorCPOne(0, msg.errorMsg, 0, func).then(() => {
        //         f(); //错误消息的模式下进入 catch ，逻辑上就和用户选择了取消一样
        //     });
        //     //}
        // }
        if (flag == 2) {
          // 提示消息，只要显示一下就可以
          //if (msg.showMsg.length > 0) {
          this.ErrorCPOne(0, msg.showMsg, 0, func).then(() => {
            s();
          });
          //}
        }
        //if (flag == -2 || flag == -3 || flag == 4) {
        if (flag == -1 || flag == -2 || flag == -3 || flag == 4) {
          // -2 -3 是确认消息 4 是需要录入的消息
          var msglist = [];
          if (msg.errorMsg) {
            for (let i = 0; i < msg.errorMsg.length; i++) {
              msg.errorMsg[i].errflag = "1";
              msg.errorMsg[i].kind = "错误"
              msglist.push(msg.errorMsg[i]);
            }
          }
          if (msg.confirmDefYesMsg) {
            for (let i = 0; i < msg.confirmDefYesMsg.length; i++) {
              msg.confirmDefYesMsg[i].kind = "确认[是]"
              msglist.push(msg.confirmDefYesMsg[i]);
            }
          }
          if (msg.confirmDefNoMsg) {
            for (let i = 0; i < msg.confirmDefNoMsg.length; i++) {
              msg.confirmDefNoMsg[i].kind = "确认[否]"
              msglist.push(msg.confirmDefNoMsg[i]);
            }
          }
          if (msg.inputMsg && msg.inputMsg.length > 0) {
            for (let i = 0; i < msg.inputMsg.length; i++) {
              msg.inputMsg[i].kind = "输入"
              msglist.push(msg.inputMsg[i]);
              this.InputMsg.push({ keycode: msg.inputMsg[i].keycode, msg: { title: "", content: "" } });
            }
          }
          if (msglist.length == 1) {
            if (msg.errorMsg.length > 0) {
              if (this.Options.caninputnoreqbarcode == "1" && msg.errorMsg[0].content.indexOf("未找到申请单信息") > -1) {
                s();
              } else {
                this.ErrorCPOne(0, msg.errorMsg, 0, func).then(() => {
                  f();
                });
              }
            } else if (msg.confirmDefNoMsg.length > 0) {
              this.ErrorCPOne(3, msg.confirmDefNoMsg, 0, func)
                .then(() => {
                  s();
                })
                .catch(() => {
                  f();
                });
            } else if (msg.confirmDefYesMsg.length > 0) {
              this.ErrorCPOne(2, msg.confirmDefYesMsg, 0, func)
                .then(() => {
                  s();
                })
                .catch(() => {
                  f();
                });
            } else {
              this.ErrorCPOne(1, msg.inputMsg, 0, func)
                .then(() => {
                  s();
                })
                .catch(() => {
                  f();
                });
            }
          } else {
            this.ErrorCPOne(4, msglist, 0, func)
              .then(() => {
                s();
              })
              .catch(() => {
                f();
              });
          }
        }
      });
    },
    // 错误
    ErrorCPOne(type, list, i, func) {
      //type=0 显示消息，type=1 输入消息，type=2 焦点在是提示消息,type=3 焦点在否提示消息
      return new Promise((s, f) => {
        if (list.length == 1) {
          if (type == 0) {
            this.$confirm(`<span style="font-weight:bold;color:blue;font-size:18px;">${list[i].content ? list[i].content.replace(/\r\n/g, "<br/>") : "错误"}</span>`, list[i].title ? list[i].title : "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              focusCancelButton: false,
              closeOnClickModal: false,
              showCancelButton: false,
              dangerouslyUseHTMLString: true,
              type: "warning",
            })
              .then((the) => {
                s();
              })
              .catch((cat) => {
                //只是显示的消息，没有取消按钮 无论如何都应该都进.then  s()
                s();
              });
          } else if (type == 2 || type == 3) {
            this.$confirm(`<span style="font-weight:bold;color:blue;font-size:18px;">${list[i].content ? list[i].content.replace(/\r\n/g, "<br/>") : "错误"}</span>`, list[i].title ? list[i].title : "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              focusCancelButton: type == 3,
              closeOnClickModal: false,
              dangerouslyUseHTMLString: true,
              type: "warning",
            })
              .then((the) => {
                //如果确认消息需要登录
                if (list[i].content && list[i].content.indexOf("（需登录）") > -1) {
                  this.$rm_Login({
                    type: "用户登录验证",
                    btn: {
                      confirmBtnText: "确定",
                      cancelBtnText: "取消",
                    },
                  })
                    .then((res) => {
                      if (res.flag == "1") {
                        s();
                      } else {
                        //登录失败
                        this.$message.error("用户登录失败");
                        f();
                      }
                    })
                    .catch((e) => {
                      f();//取消登录也不让他继续
                    });
                } else {
                  s();//不需要登录的就正常下一步
                }
              })
              .catch((cat) => {
                f(); //一旦用户选择了【取消】则直接退出
              });
          } else if (type == 1) {
            if (list[i].msg.content.indexOf("解除审核") > -1) {
              this.inputkeycode = list[i].keycode;
              this.unreasoncheckmsg = "";
              this.SingleSubmitdisabled = true;
              if (this.MixIndex == 0) {
                this.$refs.uncheckdialog
                  .ShowDialog()
                  .then(() => {
                    var data = this.InputMsg.find((item) => item.keycode == this.inputkeycode);
                    data.msg.content = this.unreasoncheckmsg;
                    this.mixdatamsgcontent = this.unreasoncheckmsg;
                    s();
                  })
                  .catch(() => {
                    f();
                  });
              } else {
                var data = this.InputMsg.find((item) => item.keycode == this.inputkeycode);
                data.msg.content = this.mixdatamsgcontent;
                s();
              }

              // const h = this.$createElement;
              // this.$msgbox({
              //     title: list[i].msg.title,
              //     message: <rm-ddl-common datatype="seccode" kindno="RPTUNCHKREASON" dataname="解除审核原因" width="100%" />,
              //     // message: list[i].msg.content,
              //     showCancelButton: true,
              //     confirmButtonText: "确定",
              //     cancelButtonText: "取消",
              //     closeOnClickModal: false,
              //     data: this.InputMsg.filter(i => i.keycode == list[i].keycode)[0].msg.content,
              //     beforeClose: (action, instance, done) => {
              //         if (action === "confirm") {
              //             done();
              //         } else {
              //             f();
              //             done();
              //         }
              //     }
              // }).then(action => {
              //     s();
              // });
            } else {
              this.$prompt("请输入" + list[i].msg.content, list[i].msg.title ? list[i].msg.title : "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                showCancelButton: false,
                cancelButtonClass: "el-button el-button--default el-button--small el-button--primary",
                confirmButtonClass: "el-button el-button--default el-button--small",
                focusCancelButton: false,
                closeOnClickModal: false,
                inputValidator: (v) => {
                  if (!v || v == "" || v == null) return "输入的内容不能为空";
                },
                beforeClose: (action, instance, done) => {
                  if (action === "confirm") {
                    done();
                  } else {
                    f();
                    done();
                  }
                },
              }).then(({ value }) => {
                var onemsg = this.InputMsg.filter((item) => item.keycode == list[i].keycode);

                if (onemsg && onemsg.length > 0) {
                  onemsg[0].msg.content = value;
                }
                //this.InputMsg.push({ keycode: list[i].keycode, msg: { title: "", content: value } });
                s();
              });
            }

            // this.$prompt("请输入" + list[i].msg.content, list[i].msg.title ? list[i].msg.title : "提示", {
            //     confirmButtonText: "确定",
            //     cancelButtonText: "取消",
            //     showCancelButton: false,
            //     cancelButtonClass: "el-button el-button--default el-button--small el-button--primary",
            //     confirmButtonClass: "el-button el-button--default el-button--small",
            //     focusCancelButton: false,
            //     closeOnClickModal: false,
            //     inputValidator: v => {
            //         if (!v || v == "" || v == null) return "输入的内容不能为空";
            //     }
            // })
            //     .then(({ value }) => {
            //         console.log("444", value);

            //         var onemsg = this.InputMsg.filter(item => item.keycode == list[i].keycode);
            //         if (onemsg && onemsg.length > 0) {
            //             onemsg.msg.content = value;
            //         }
            //         //this.InputMsg.push({ keycode: list[i].keycode, msg: { title: "", content: value } });
            //         s();
            //         return;
            //     })
            //     .catch(({ value }) => {
            //         console.log("333");
            //         f();
            //         return;
            //     });
          } else {
            s();
          }
        } else {
          if (this.Options.collectallcheckmsgtoonepage == '1') {
            this.tableDataMsgDialog = list;
            if (this.InputMsg.length == 0) this.Submitdisabled = false;
            else this.Submitdisabled = true;
            this.msglist = list;
            if (this.msglist[0].kind == "错误") this.Submitdisabled = true;
            this.inmsg = "";
            this.showInputColumn = true;
            if (this.tableDataMsgDialog.findIndex(item => item.kind == "输入") == -1) {
              this.showInputColumn = false;
            }
            this.$refs.msglistdialog
              .ShowDialog()
              .then(() => {
                //可以点确认代表没有错误消息并且输入消息也已经输入
                let needlogin = list.find((item) => item.content && item.content.indexOf("（需登录）") > -1);
                //如果确认消息需要登录
                if (needlogin) {
                  this.$rm_Login({
                    type: "用户登录验证",
                    btn: {
                      confirmBtnText: "确定",
                      cancelBtnText: "取消",
                    },
                  })
                    .then((res) => {
                      if (res.flag == "1") {
                        s();
                      } else {
                        //登录失败
                        this.$message.error("用户登录失败");
                        f();
                      }
                    })
                    .catch((e) => {
                      f();//取消登录也不让他继续
                    });
                } else {
                  s();//不需要登录的就正常下一步
                }
              })
              .catch(() => {
                f();
              });
          } else {
            if (list) this.TotalMsgNo = list.length;
            this.NowMsgNo = 1;
            this.MsgAllOver = true;
            if (this.InputMsg.length == 0) this.Submitdisabled = false;
            else this.Submitdisabled = true;
            this.msglist = list;
            if (this.msglist[0].kind == "错误") this.Submitdisabled = true;
            this.inmsg = "";
            this.msglist.forEach(item => {
              if (item.content) item.content = item.content.replace(/\r\n/g, "<br/>")
            });
            this.$refs.msgdialog
              .ShowDialog()
              .then(() => {
                //可以点确认代表没有错误消息并且输入消息也已经输入
                let needlogin = list.find((item) => item.content && item.content.indexOf("（需登录）") > -1);
                //如果确认消息需要登录
                if (needlogin) {
                  this.$rm_Login({
                    type: "用户登录验证",
                    btn: {
                      confirmBtnText: "确定",
                      cancelBtnText: "取消",
                    },
                  })
                    .then((res) => {
                      if (res.flag == "1") {
                        s();
                      } else {
                        //登录失败
                        this.$message.error("用户登录失败");
                        f();
                      }
                    })
                    .catch((e) => {
                      f();//取消登录也不让他继续
                    });
                } else {
                  s();//不需要登录的就正常下一步
                }
              })
              .catch(() => {
                f();
              });
          }
        }
      });
    },
    // 单独打印
    singleprint(selreportid) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "getrptstyleid",
            reportid: selreportid,
          },
        })
        .then((res) => {
          if (res != "")
            //调整
            this.$pub.printreport(this, selreportid, "1", res);
        });
    },
    //多选弹窗
    popMultipleChk(e, fieldname, option, title) {
      var datatype = "";
      if (fieldname == "reqitem") datatype = "Multi_reqitem";
      this.multidatatype = datatype;
      if (datatype != "") {
        this.multivalue = e;
        this.option1 = [];
        this.option2 = [];
      } else {
        let temp = XE.clone(option, true);
        this.option1 = [];
        this.option2 = [];
        if (e && e != "") {
          let k = e.split(",");
          k.forEach((item) => {
            let ndata = temp.find((m) => m.data == item);
            if (ndata != undefined && ndata != null) {
              this.option2.push(ndata);
            }
          });
          temp.forEach((item) => {
            if (k.indexOf(item.data + "") < 0) {
              this.option1.push(item);
            }
          });
        } else {
          this.option1 = temp;
        }
      }
      this.fieldname = fieldname;
      this.multichktitle = title;
      this.dialogMultipleVisible = true;
    },
    // 关闭
    closedialog(value, name) {
      if (value != "close") {
        this[name] = value;
      }
      this.dialogMultipleVisible = false;
    },
    // 值班医生设置成功后
    SaveDutyManRe(usr) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "savedutyman",
            rptunitid: this.rptunitid,
            sampledate: this.selectdate,
            userno: usr,
          },
        })
        .then((res) => {
          if (res.hasOwnProperty("flag") && res.flag == "1") {
            this.$message.success("安排值班成功!");
          } else this.$alert(res.msg ? res.msg : res.errmsg, "错误");
        })
        .catch((err) => {
          console.log("instrdataerr:" + err);
        });
    },
    // #endregion 其他

    // #endregion 通用方法库


    // #region 弹窗方法库

    // #region 复查结果输入弹窗
    // 复查结果选择
    rechkhandleIconClick() {
      this.rechktextvalueshow = !this.rechktextvalueshow;
    },
    // 复查结果选择弹窗
    ResultDblClick() {
      this.rechktextvalueshow = false;
      this.dialogrechkResultVisible = true;

      if (this.tablerechkDataResultS.length > 0) {
        this.$nextTick(() => {
          this.$refs.xTablerechkResultAll.setCurrentRow(this.$refs.xTablerechkResultAll.getData(0));
        });
      }
    },
    // 编辑开启
    rechkResultActive({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, cell }) {

      this.iconclass = "el-icon-arrow-down";
      this.rechktextvalueshow = false;
      this.QueryResultAll(row.rpt_itemcode, 0);
      this.$refs.rmlabresult.oldval = row[column.property];
    },
    // 编辑关闭
    rechkResultClose({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, cell }) {
      if (row.redo_result) {
        var selectrow = this.tableDataResultAll.filter(item => item.inputcode == row.redo_result);
        if (selectrow.length > 0) {
          row.redo_result = selectrow[0].textvalue;
        }
      }
      this.rechktextvalueshow = false;
    },
    // 获取报告项目常用结果
    QueryResultAll(rptitemcode, rekind) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "getrptitemval",
            rpt_itemcode: rptitemcode,
            resultkind: rekind,
            rptunitid: this.myrptunitid
          }
        })
        .then(res => {
          //this.tableColumnResultAll = res.Cols;
          this.tableDataResultAll = res.Data;
          this.tablerechkDataResultS = res.Data;
          if (this.tableDataResultAll.length > 0 && this.Options.showrptitemvalbyfocus == "2") {
            this.rechktextvalueshow = true;
          }
        });
    },
    // 复查结果选择弹窗后选择结果
    ResultTextClick({ row }, rptrow) {
      rptrow.redo_result = row.textvalue;
      this.rechktextvalueshow = false;
    },
    // 结果输入回车事件
    rechkAddRow(row, rowIndex) {
      var lastrow = this.$refs.xtableReChkDetaildialog.tableFullData[this.$refs.xtableReChkDetaildialog.tableFullData.length - 1];
      if (lastrow._XID == row._XID) {
        if (row.redo_result) {
          var selectrow = this.tableDataResultAll.filter(item => item.inputcode == row.redo_result);
          if (selectrow.length > 0) {
            row.redo_result = selectrow[0].textvalue;
          }
        }
      } else {
        var thisrow = this.$refs.xtableReChkDetaildialog.tableFullData[rowIndex + 1];
        this.$refs.xtableReChkDetaildialog.setActiveCell(thisrow, "redo_result");
      }
    },
    // 结果输入向上向下
    rechkResultMove(row, type, index, coltype) {
      if (type == 1) {//向下
        if (index < this.$refs.xtableReChkDetaildialog.tableFullData.length - 1) {
          var row = this.$refs.xtableReChkDetaildialog.tableFullData[index + 1];
          this.$refs.xtableReChkDetaildialog.setCurrentRow(row);
          this.$refs.xtableReChkDetaildialog.setActiveCell(row, "redo_result");
        }
      } else {
        if (index != 0) {
          var row = this.$refs.xtableReChkDetaildialog.tableFullData[index - 1];
          this.$refs.xtableReChkDetaildialog.setCurrentRow(row);
          this.$refs.xtableReChkDetaildialog.setActiveCell(row, "redo_result");
        }
      }
    },

    // 结果标志
    ReusltflagName(flag) {
      switch (flag) {
        case "M":
          return "正常";
        case "H":
          return "偏高";
        case "L":
          return "偏低";
        case "P":
          return "阳性";
        case "W":
          return "弱阳性";
        case "E":
          return "错误";
        case "Q":
          return "弱阳性";
        default:
          return "";
      }
    },
    // 复查结果双击
    rechkDblEvent({ row, rowIndex, $rowIndex, column }) {
      if (column.property == "redo_result") {
        this.dialogrechkResultVisible = true;
        if (this.tablerechkDataResultS.length > 0)
          this.$nextTick(() => {
            this.$refs.xTablerechkResultAll.setCurrentRow(this.$refs.xTablerechkResultAll.getData(0));
          });
      }
    },
    SelectInputChange(val, row) {
      row.redo_reason = val.target.value;
    },
    // 加载
    CopyCurResult(row) {
      if (row.redo_result != "" && row.redo_result != row.result_str) {
        this.$confirm("已有的复查结果和当前检验结果不一致，确定要加载吗？", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          focusCancelButton: true,
          type: "warning",
        })
          .then(() => {
            row.redo_result = row.result_str;
          })
          .catch(() => { });
      } else {
        row.redo_result = row.result_str;
      }

    },
    // 加载全部结果
    CopybeforeToNow() {
      var rows = this.$refs.xtableReChkDetaildialog.tableFullData;
      //把所有不为空的复查结果全部设置为检验结果
      rows.forEach(item => {
        if (item.redo_result == "" && item.result_str != "") item.redo_result = item.result_str;
      });
    },
    // 确定修改复查结果
    RechkDetailSubmit() {
      var rows = this.$refs.xtableReChkDetaildialog.tableFullData;
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "saveredoinput",
            reportid: this.PatientInfo.reportid,
            override: this.ReChkDetailOverride,
            tabstr: rows,
          },
        })
        .then((res) => {
          if (res.flag == 1) {
            this.$message({
              type: "success",
              message: "手动输入复查结果成功!",
            });
            this.dialogRechkDetailVisible = false;
            this.$refs.rmlabresult.QueryResult(this.PatientInfo);
          } else {
            this.$alert(res.msg, "提示");
          }
        });
    },
    // #endregion 复查结果输入弹窗

    // #region 报告项目复查结果选择开窗

    // 快速检索
    rechkResultSearchkeydown() {
      this.tablerechkDataResultS = this.tablerechkDataResultAll.filter(item => item.textvalue.toUpperCase().indexOf(this.rechkResultqcode.toUpperCase()) > -1 || item.rechkResultqcode.toUpperCase().indexOf(this.rechkResultqcode.toUpperCase()) > -1 || (item.seq + "").indexOf(this.rechkResultqcode.toUpperCase()) > -1);
    },
    // 结果选择确定
    rechkResultok() {
      var row = this.$refs.xTablerechkResultAll.getCurrentRow();
      if (row) {
        var uprow = this.$refs.xtableReChkDetaildialog.tableFullData.filter(item => item.rpt_itemcode == row.rpt_itemcode)[0];
        uprow.redo_result = row.textvalue;
      } else {
        this.$message("未选中报告结果!");
      }
    },
    // 双击选择结果
    rechkResultSelect({ row }) {
      var uprow = this.$refs.xtableReChkDetaildialog.tableFullData.filter(item => item.rpt_itemcode == row.rpt_itemcode)[0];
      uprow.redo_result = row.textvalue;
      this.dialogrechkResultVisible = false;
    },
    // 取消弹窗
    rechkResultcancel() {
      this.dialogrechkResultVisible = false;
    },
    // #endregion 报告项目复查结果选择开窗

    // #region 按钮配置弹窗
    //表格功能
    currentChangeEvent({ row }) {
      this.currentindex = this.$refs.buttontable.getRowIndex(row);
    },
    // 确定设置
    ButtonConfirm() {
      var btnstr = "";
      var list = this.$refs.buttontable.tableData.filter((item) => item.visible == "1" || item.field == "0");
      for (let i = 0; i < list.length; i++) {
        btnstr += list[i].field + ",";
      }
      btnstr = btnstr.substring(0, btnstr.length - 1);
      localStorage.setItem("REPORT_BUTTONFLOAT", btnstr);
      this.dialogButtonConfigVisible = false;
      this.InitButton();
    },
    // 移动到首位
    SetFirst(table) {
      if (table.getCurrentRow()) {
        var currentrow = table.getCurrentRow();
        table.tableData = table.tableData.filter((item) => item._XID != currentrow._XID);
        table.tableData.splice(0, 0, currentrow);
        this.currentindex = 0;
        setTimeout(() => {
          table.scrollToRow(currentrow);
          table.setCurrentRow(currentrow);
        }, 1);
      }
    },
    // 上移
    SetUp(table) {
      if (this.currentindex > 0) {
        var currentrow = table.getCurrentRow();
        table.tableData = table.tableData.filter((item) => item._XID != currentrow._XID);
        table.tableData.splice(this.currentindex - 1, 0, currentrow);
        this.currentindex -= 1;
        setTimeout(() => {
          table.scrollToRow(currentrow);
          table.setCurrentRow(currentrow);
        }, 1);
      }
    },
    // 下移
    SetDown(table) {
      if (this.currentindex >= 0 && this.currentindex < table.tableData.length - 1) {
        var currentrow = table.getCurrentRow();
        table.tableData = table.tableData.filter((item) => item._XID != currentrow._XID);
        table.tableData.splice(this.currentindex + 1, 0, currentrow);
        this.currentindex += 1;
        setTimeout(() => {
          table.scrollToRow(currentrow);
          table.setCurrentRow(currentrow);
        }, 1);
      }
    },
    // 移动到末尾
    SetLast(table) {
      if (table.getCurrentRow()) {
        var currentrow = table.getCurrentRow();
        table.tableData = table.tableData.filter((item) => item._XID != currentrow._XID);
        table.tableData.push(currentrow);
        this.currentindex = table.tableData.length - 1;
        setTimeout(() => {
          table.scrollToRow(currentrow);
          table.setCurrentRow(currentrow);
        }, 1);
      }
    },
    // 默认顺序
    resort(table) {
      var reg = new RegExp("[0-9]{1,}", "gi");
      var row = table.getCurrentRow();
      table.tableData.sort((a, b) => a._XID.match(reg) - 0 - (b._XID.match(reg) - 0));
      setTimeout(() => {
        table.setCurrentRow(row);
        this.currentindex = table.getRowIndex(row);
      }, 1);
    },
    // #endregion 按钮配置弹窗

    // #region 单项合并弹窗

    // 选择当前合并行
    currentmergeChangeEvent({ row }) {
      this.QueryBindmdldetail(row);
    },
    // 获取输入模板
    QueryBindmdl() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "getbindmdl",
            reportid: this.PatientInfo.reportid,
            rptunitid: this.rptunitid,
          },
        })
        .then((res) => {
          if (res) {
            this.tableDatamergeLeft = res;
            setTimeout(() => {
              var row = this.$refs.xtablemerge.getData(0);
              this.$refs.xtablemerge.setCurrentRow(row);
              this.QueryBindmdldetail(row);
            }, 1);
          }
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    // 获取输入模板对应项目
    QueryBindmdldetail(row) {
      if (!row) row = this.$refs.xtablemerge.getCurrentRow();
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "getbindmdldetail",
            bindmdlid: row.bindmdlid,
            sampledate: this.selectdate,
            rptunitid: this.rptunitid,
            sampleno: this.mergespecno,
            rptitemcode: row.rpt_itemcode,
            mergemethod: this.mergemethod,
          },
        })
        .then((res) => {
          if (res.Data1) {
            this.tableDatamergeRight = res.Data1;
            if (res.Data2) {
              this.MergeDataFind(res.Data2);
              this.RightSaveArr = res.Data2;
            } else {
              this.RightSaveArr = [];
            }
          } else {
            this.RightSaveArr = [];
          }
        })
        .catch((error) => {
          this.$message.error("错误1:" + error);
        });
    },
    // 查找合并数据
    MergeDataFind(data2) {
      var reg = new RegExp("\\d+(?=[^0-9]*$)", "g");
      if (this.mergemethod == "4") {
        //样本号依序添加
        var nowspec = XE.clone(this.mergespecno, true);
        for (let i = 0; i < this.tableDatamergeRight.length; i++) {
          var specrow = data2.filter((item) => item.sampleno == nowspec && item.sampledate == this.selectdate);
          this.tableDatamergeRight[i].sampleno = nowspec;
          if (specrow.length > 0) {
            this.tableDatamergeRight[i].result_str = specrow[0].result_str;
            this.tableDatamergeRight[i].pat_name = specrow[0].pat_name;
            this.tableDatamergeRight[i].first_dt = specrow[0].first_dt;
          } else {
            this.tableDatamergeRight[i].first_dt = "0000-00-00 00:00:00";
          }
          var regarr = nowspec.match(reg);
          if (regarr.length > 0) {
            var num = regarr[regarr.length - 1];
            var exacnum = nowspec.replace(reg, num - 0 + 1);
            nowspec = exacnum;
          }
        }
      } else {
        var length = this.tableDatamergeRight.length - data2.length; //判断找到的数据和应填的数据量的大小比较
        if (length > 0) {
          for (let i = 0; i < data2.length; i++) {
            this.tableDatamergeRight[i].sampleno = data2[i].sampleno;
            this.tableDatamergeRight[i].result_str = data2[i].result_str;
            this.tableDatamergeRight[i].pat_name = data2[i].pat_name;
            this.tableDatamergeRight[i].first_dt = data2[i].first_dt;
          }
          var elsespec = XE.clone(this.mergespecno, true);
          var regarr = elsespec.match(reg);
          var num = regarr[regarr.length - 1];
          elsespec = elsespec.replace(reg, num - 0 - 1);
          if (data2.length > 0) elsespec = data2[data2.length - 1].sampleno;
          for (let i = data2.length; i < this.tableDatamergeRight.length; i++) {
            var regarr = elsespec.match(reg);
            if (regarr.length > 0) {
              var num = regarr[regarr.length - 1];
              var exacnum = elsespec.replace(reg, num - 0 + 1);
              elsespec = exacnum;
            }
            this.tableDatamergeRight[i].sampleno = elsespec;
            this.tableDatamergeRight[i].first_dt = "0000-00-00 00:00:00";
          }
        } else {
          for (let i = 0; i < this.tableDatamergeRight.length; i++) {
            this.tableDatamergeRight[i].sampleno = data2[i].sampleno;
            this.tableDatamergeRight[i].result_str = data2[i].result_str;
            this.tableDatamergeRight[i].pat_name = data2[i].pat_name;
            this.tableDatamergeRight[i].first_dt = data2[i].first_dt;
          }
        }
      }
    },
    // 提交合并
    MergeSubmit() {
      //合并提交
      var row = this.$refs.xtablemerge.getCurrentRow();
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "mergeitems",
            sampledate: this.selectdate,
            rptunitid: this.rptunitid,
            sampleno: this.mergespecno,
            rptitemcode: row.rpt_itemcode,
            rptitemname: row.rpt_itemname,
            sampleitems: this.$refs.xtablemergeright.tableFullData.filter((item) => item.result_str != ""),
          },
        })
        .then((res) => {
          if (res.Item1 == "1") {
            this.$message({
              type: "success",
              message: "合并成功!",
            });
            this.dialogmergeVisible = false;
            this.$refs.rmlabresult.QueryResult(this.PatientInfo).then(() => {
              //this.AfterQResult();
            });
          }
          else if (res.Item1 == "2") {
            this.dialogmergeVisible = false;
            this.$refs.rmlabresult.QueryResult(this.PatientInfo);
            this.$alert(res.Item2.replace(/\r\n/g, "<br/>"), "提示", { dangerouslyUseHTMLString: true });
          }
          else {
            this.$alert(res.Item2, "错误");
          }
        });
    },
    //合并右侧表格标本号更改
    mergesamplechange({ row }) {
      var specrow = this.filter((item) => item.sampleno == row.sampleno && item.sampledate == this.selectdate);
      if (specrow.length > 0) {
        row.result_str = specrow[0].result_str;
        row.pat_name = specrow[0].pat_name;
        row.first_dt = specrow[0].first_dt;
      } else {
        row.result_str = "";
        row.pat_name = "";
        row.first_dt = "0000-00-00 00:00:00";
      }
    },

    // #endregion 单项合并弹窗

    // #region his接口返回申请项目开窗
    HisReturnClass({ row, rowIndex }) {
      if (row.selectflag == "-1") {
        return "disabled-cell";
      } else if (row.bselect) {
        return "RechkBack";
      }
    },
    // 全选
    HisChangeAll(value) {
      if (value) {
        for (let i = 0; i < this.tableDataHisReturn.length; i++) {
          if (this.tableDataHisReturn[i].selectflag != -1) this.tableDataHisReturn[i].bselect = true;
        }
      } else {
        for (let i = 0; i < this.tableDataHisReturn.length; i++) {
          if (this.tableDataHisReturn[i].selectflag != -1) this.tableDataHisReturn[i].bselect = false;
        }
      }
    },
    // 显示所有项目
    filterHisReq() {
      var value = this.HisReAppDate;
      if (value > 0) {
        var date = this.sysdate + " 00:00:00";
        var extdate = new Date(date);
        var redate = extdate - (value - 0) * 24 * 3600 * 1000;
        var reaxrdate = new Date(redate);
        var redatestr = reaxrdate.getFullYear() + "/" + (reaxrdate.getMonth() + 1) + "/" + reaxrdate.getDate() + " 00:00:00";
        if (this.showallrptitem) {
          this.tableDataHisReturn = this.tableDataHisReturnAll.filter((item) => new Date(item.req_dt) >= reaxrdate).sort((a, b) => this.sortPatPopReqItemList(a, b));
        } else {
          this.tableDataHisReturn = this.tableDataHisReturnAll.filter((item) => new Date(item.req_dt) >= reaxrdate && item.rmmemo1 == "1").sort((a, b) => this.sortPatPopReqItemList(a, b));
        }
      } else {
        if (this.showallrptitem) {
          this.tableDataHisReturn = this.tableDataHisReturnAll.sort((a, b) => this.sortPatPopReqItemList(a, b));
        } else {
          this.tableDataHisReturn = this.tableDataHisReturnAll.filter((item) => item.rmmemo1 == "1").sort((a, b) => this.sortPatPopReqItemList(a, b));
        }
      }
    },
    // 病人申请项目排序
    sortPatPopReqItemList(a, b) {
      if (a.selectflag == b.selectflag) {
        return a.iPos - b.iPos;
      } else {
        return b.selectflag - a.selectflag;
      }
    },
    // 保存申请
    SavePopReq() {
      var reqinfo = this.tableDataHisReturn.filter((item) => item.bselect == true);
      //把申请信息的第一条信息中和病人信息有相同字段的值赋值给病人信息
      if (reqinfo && reqinfo.length > 0) {
        for (let i in this.poppatient) {
          if (reqinfo[0].hasOwnProperty(i) && reqinfo[0][i] != "") {
            this.poppatient[i] = reqinfo[0][i];
          }
        }
      }

      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "savepopreq",
            reqinfo: reqinfo,
            patinfo: this.poppatient,
          },
        })
        .then((res) => {
          if (res.flag == "1") {
            this.dialogRptItemVisible = false;
            this.PatientInfo.barcode = res.barcode;
            //this.OldPatientInfo.barcode = XE.clone(res.barcode, true);
            //this.oldbarcode = this.OldPatientInfo.barcode;

            this.BarcodeRequest()
              .then((res) => {
                this.afterBarcodeInputSuccess(res).then(() => {
                  this.changekeyflag = false;
                });
              })
              .catch((e) => {
                this.PatientInfo.barcode = ""; //出错的话，条码号一律清空
                this.oldbarcode = "";
                this.OldPatientInfo.barcode = "";
                this.changekeyflag = false;
              });
          } else {
            this.$alert(res.msg, "错误", {
              confirmButtonText: "确定",
            });
          }
        });
    },
    // #endregion his接口返回申请项目开窗

    // #region 报告单元文字描述结果选择开窗
    // 单击
    AdviceClick({ row }) {
      if (this.advicetxt) {
        if (this.advicetxt.indexOf(row.txtinfo) == -1) {
          if (this.appendChangeRow) {
            this.advicetxt += "\n" + row.txtinfo;
          } else {
            if (this.advicetxt) {
              this.advicetxt += "," + row.txtinfo;
            } else {
              this.advicetxt += row.txtinfo;
            }
          }
        }
      } else {
        this.advicetxt = row.txtinfo;
      }
    },
    // 双击
    AdvicedblClick({ row }) {
      this.advicetxt = row.txtinfo;
      this.PatientInfo[this.popdatatype.replace("LIS3_", "")] = row.txtinfo;
    },
    // 查询自动审核复查
    Queryautochkreview() {
      if (this.InputCodeArr.find((item) => item.key == "autochkreview")) {
        var res = this.InputCodeArr.find((item) => item.key == "autochkreview");
        this.tableDataAdviceAll = XE.clone(res, true);
        this.tableDataAdvice = res;
        this.dialogAdviceVisible = true;
        return;
      }
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "searchautochkreview",
          },
        })
        .then((res) => {
          if (!res.hasOwnProperty("errcode")) {
            this.InputCodeArr.push({ key: "autochkreview", list: res });
            this.tableDataAdviceAll = XE.clone(res, true);
            this.tableDataAdvice = res;
            this.dialogAdviceVisible = true;
            //this.dialogAdvicefloatwindowVisible = true;
          }
        });
    },
    // 确定按钮
    AdviceSubmit() {
      if (this.advicetype == "2") {
        this.imagecomm = this.advicetxt; //.replace(/\n/g, "\\n");
        this.ImageList.filter((item) => item.seq == this.selectseq)[0].comm = this.advicetxt; //.replace(/\n/g, "\\n");
        this.ImageDiff = true;
      } else if (this.advicetype == "3") {
        //自动审核不符合原因
        this.unsimilarreason = this.advicetxt;
      } else {
        if (this.Options.inputasreportuser != "1") {
          this.PatientInfo.report_username = this.exactusernamereport;
          this.PatientInfo.report_user = this.exactusernoreport;
        }
        //this.PatientInfo.lab_advice = this.advicetxt; //.replace(/\n/g, "\\n");
        this.PatientInfo[this.popdatatype.replace("LIS3_", "")] = this.advicetxt; //.replace(/\n/g, "\\n");
      }
      this.dialogAdviceVisible = false;
    },
    // 快速查找筛选
    AdviceSearch(value) {
      if (value) {
        this.tableDataAdvice = this.tableDataAdviceAll.filter((item) => item.txttitle.toUpperCase().indexOf(value.toUpperCase()) > -1 || item.txtinfo.toUpperCase().indexOf(value.toUpperCase()) > -1 || item.inputcode.toUpperCase().indexOf(value.toUpperCase()) > -1);
      } else {
        this.tableDataAdvice = XE.clone(this.tableDataAdviceAll, true);
      }
    },
    // #endregion 报告单元文字描述结果选择开窗

    // #region 删除原因开窗
    // 填写删除原因用户名自动显示名称
    getdelusername() {
      this.$tool
        .request({
          url: "ucent/ddl",
          method: "post",
          data: {
            action: "doctor",
          },
        })
        .then((res) => {
          if (!res.hasOwnProperty("errcode")) {
            if (res.Data) {
              var valuename = res.Data.find((item) => item.hidkey == this.loginusercode);
              if (valuename) this.loginusername = valuename.hidname;
              else this.loginusername = this.loginusercode;
            }
          }
        });
    },
    // #endregion 删除原因开窗

    // #region 病人年龄弹窗
    //年龄弹框单选改变事件
    AgeRadioChange(value) {
      switch (value) {
        case "岁":
          this.radiosonunit = "月";
          this.reagestrch = (this.inputfatherage ? this.inputfatherage + "岁" : "") + (this.inputsonage ? this.inputsonage + "月" : "");
          break;
        case "月":
          this.radiosonunit = "日";
          this.reagestrch = (this.inputfatherage ? this.inputfatherage + "月" : "") + (this.inputsonage ? this.inputsonage + "日" : "");
          break;
        case "日":
          this.radiosonunit = "小时";
          this.reagestrch = (this.inputfatherage ? this.inputfatherage + "日" : "") + (this.inputsonage ? this.inputsonage + "小时" : "");
          break;
        case "小时":
          this.radiosonunit = "分钟";
          this.reagestrch = (this.inputfatherage ? this.inputfatherage + "小时" : "") + (this.inputsonage ? this.inputsonage + "分钟" : "");
          break;
        case "分钟":
          this.radiosonunit = "分钟";
          this.reagestrch = this.inputfatherage ? this.inputfatherage + "分钟" : "";
          break;
      }
    },
    // 年龄输入
    ageinput(value, type) {
      if (type === 1 && value) {
        this.reagestrch = value + this.radiofatherunit + (this.inputsonage ? this.inputsonage + this.radiosonunit : "");
      }
      if (type === 2 && value && this.radiofatherunit != "分钟") {
        this.reagestrch = (this.inputfatherage ? this.inputfatherage + this.radiofatherunit : "") + value + this.radiosonunit;
      }
    },
    // 年龄提交
    AgeSubmit() {
      if (this.Options.inputasreportuser != "1") {
        this.PatientInfo.report_username = this.exactusernamereport;
        this.PatientInfo.report_user = this.exactusernoreport;
      }
      this.PatientInfo.pat_agestr = this.reagestrch + "";
      this.PatientInfo.pat_ageyear = this.ageTransform(this.reagestrch);
      this.dialogAgeVisible = false;
      this.$refs.pat_agestr[0].select();
    },
    // 年龄格式化转变
    ageTransform(agestr) {
      var reg = new RegExp("\\d{1,}(y|Y|岁|年){0,}\\d{0,}(m|M|月){0,}\\d{0,}(d|D|日){0,}\\d{0,}(h|H|小时){0,}\\d{0,}(f|F|分钟){0,}", "gi");
      var regd = new RegExp("^\\d{1,}$", "gi");
      var regda = new RegExp("\\d{1,}", "gi");
      var ageyear = 0;
      if (agestr.match(regd)) {
        ageyear = agestr - 0;
      } else if (agestr.match(reg)) {
        var numarr = agestr.match(regda);
        let i = 0;
        while (i < numarr.length) {
          if (agestr.indexOf("岁") > 0) {
            agestr = agestr.replace("岁", "|");
            ageyear += numarr[i] - 0;
            i++;
          } else if (agestr.indexOf("月") > 0) {
            agestr = agestr.replace("月", "|");
            ageyear += (numarr[i] - 0) / 12;
            i++;
          } else if (agestr.indexOf("日") > 0) {
            agestr = agestr.replace("日", "|");
            ageyear += (numarr[i] - 0) / 365;
            i++;
          } else {
            i++;
          }
        }
        return ageyear.toFixed(4);
      }
    },
    // #endregion 病人年龄弹窗

    // #region 医生更换登录弹窗
    // 更换登录医生
    LoginChange() {
      var action = this.popdatatype == "LIS3_report_user" ? "loginreportuser" : "logincheckuser";
      //后台查询登录判断是否成功
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: action,
            userno: this.usercode,
            pwd: md5("rms-" + this.userpwd + "-rme"),
            rptunitid: this.rptunitid,
            reportid: this.PatientInfo.reportid,
            changetype: this.specinuseflag,
            sampleno: this.specrange,
          },
        })
        .then((res) => {
          if (res.errcode > 0) {
            //成功后续逻辑dialogLoginVisible
            switch (this.specinuseflag) {
              case "1":
                this.PatientInfo[this.popdatatype.replace("LIS3_", "")] = this.usercode + "";
                this.PatientInfo[this.popdatatype.replace("LIS3_", "") + "name"] = this.username + "";
                this.OldPatientInfo[this.popdatatype.replace("LIS3_", "")] = this.usercode + "";
                this.OldPatientInfo[this.popdatatype.replace("LIS3_", "") + "name"] = this.username + "";
                break;
              case "2":
                this.PatientInfo[this.popdatatype.replace("LIS3_", "")] = this.usercode + "";
                this.PatientInfo[this.popdatatype.replace("LIS3_", "") + "name"] = this.username + "";
                this.OldPatientInfo[this.popdatatype.replace("LIS3_", "")] = this.usercode + "";
                this.OldPatientInfo[this.popdatatype.replace("LIS3_", "") + "name"] = this.username + "";
                this.popdatatype != "LIS3_report_user" && this.popdatatype != "LIS3_rechk_user";
                if (this.popdatatype == "LIS3_rechk_user") {
                  this.exactusernorhk = this.usercode + "";
                  this.exactusernamerhk = this.username + "";
                } else {
                  this.exactusernoreport = this.usercode + "";
                  this.exactusernamereport = this.username + "";
                }
                break;
              case "3":
                this.PatientInfo[this.popdatatype.replace("LIS3_", "")] = this.usercode + "";
                this.PatientInfo[this.popdatatype.replace("LIS3_", "") + "name"] = this.username + "";
                this.OldPatientInfo[this.popdatatype.replace("LIS3_", "")] = this.usercode + "";
                this.OldPatientInfo[this.popdatatype.replace("LIS3_", "") + "name"] = this.username + "";
                this.popdatatype != "LIS3_report_user" && this.popdatatype != "LIS3_rechk_user";
                if (this.popdatatype == "LIS3_rechk_user") {
                  this.exactusernorhk = this.usercode + "";
                  this.exactusernamerhk = this.username + "";
                  for (var i = 0; i < this.tableDataListS.length; i++) {
                    if (this.tableDataListS[i].rechkflag != "9") {
                      this.tableDataListS[i].rechk_user = this.usercode + "";
                      this.tableDataListS[i].rechk_username = this.username + "";
                    }
                  }
                  for (var i = 0; i < this.tableDataList.length; i++) {
                    if (this.tableDataList[i].rechkflag != "9") {
                      this.tableDataList[i].rechk_user = this.usercode + "";
                      this.tableDataList[i].rechk_username = this.username + "";
                    }
                  }
                } else {
                  this.exactusernoreport = this.usercode + "";
                  this.exactusernamereport = this.username + "";
                  for (var i = 0; i < this.tableDataListS.length; i++) {
                    if (this.tableDataListS[i].rechkflag != "9") {
                      this.tableDataListS[i].report_user = this.usercode + "";
                      this.tableDataListS[i].report_username = this.username + "";
                    }
                  }
                  for (var i = 0; i < this.tableDataList.length; i++) {
                    if (this.tableDataList[i].rechkflag != "9") {
                      this.tableDataList[i].report_user = this.usercode + "";
                      this.tableDataList[i].report_username = this.username + "";
                    }
                  }
                }
                break;
              case "4":
                this.PatientInfo[this.popdatatype.replace("LIS3_", "")] = this.usercode + "";
                this.PatientInfo[this.popdatatype.replace("LIS3_", "") + "name"] = this.username + "";
                this.OldPatientInfo[this.popdatatype.replace("LIS3_", "")] = this.usercode + "";
                this.OldPatientInfo[this.popdatatype.replace("LIS3_", "") + "name"] = this.username + "";
                this.popdatatype != "LIS3_report_user" && this.popdatatype != "LIS3_rechk_user";
                if (this.popdatatype == "LIS3_rechk_user") {
                  if (res.idarray && res.idarray.length > 0) {
                    for (var i = 0; i < this.tableDataListS.length; i++) {
                      if (this.tableDataListS[i].sampledate == this.selectdate && res.idarray.indexOf(this.tableDataListS[i].sampleno) > -1) {
                        this.tableDataListS[i].rechk_user = this.usercode + "";
                        this.tableDataListS[i].rechk_username = this.username + "";
                      }
                    }
                    for (var i = 0; i < this.tableDataList.length; i++) {
                      if (this.tableDataList[i].sampledate == this.selectdate && res.idarray.indexOf(this.tableDataList[i].sampleno) > -1) {
                        this.tableDataList[i].rechk_user = this.usercode + "";
                        this.tableDataList[i].rechk_username = this.username + "";
                      }
                    }
                  }
                  this.exactusernorhk = this.usercode + "";
                  this.exactusernamerhk = this.username + "";
                } else {
                  if (res.idarray && res.idarray.length > 0) {
                    for (var i = 0; i < this.tableDataListS.length; i++) {
                      if (this.tableDataListS[i].sampledate == this.selectdate && res.idarray.indexOf(this.tableDataListS[i].sampleno) > -1) {
                        this.tableDataListS[i].report_user = this.usercode + "";
                        this.tableDataListS[i].rechk_username = this.username + "";
                      }
                    }
                    for (var i = 0; i < this.tableDataList.length; i++) {
                      if (this.tableDataList[i].sampledate == this.selectdate && res.idarray.indexOf(this.tableDataListS[i].sampleno) > -1) {
                        this.tableDataList[i].report_user = this.usercode + "";
                        this.tableDataList[i].rechk_username = this.username + "";
                      }
                    }
                  }
                  this.exactusernoreport = this.usercode + "";
                  this.exactusernamereport = this.username + "";
                }
                break;
            }
            this.specinuseflaginrecord = XE.clone(this.specinuseflag, true);
            this.dialogLoginVisible = false;
            this.$refs[this.popdatatype.replace("LIS3_", "")][0].select();
          } else {
            this.$confirm(res.errmsg, "错误", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              focusCancelButton: false,
              closeOnClickModal: false,
              type: "warning",
            });
          }
        });

      //失败的逻辑
    },
    // 取消登录
    LoginCancel() {
      this.dialogLoginVisible = false;
      this.specinuseflag = "1";
      this.userpwd = "";
      this.popdatatype.indexOf("rechk") > -1 ? (this.PatientInfo.rechk_username = "") : (this.PatientInfo.report_username = "");
      this.$refs[this.popdatatype.replace("LIS3_", "")][0].select();
    },
    // #endregion 医生更换登录弹窗

    // #region 危急值上报弹窗
    //危急值上报弹窗
    CheckDangerDeal(alertinfo, type) {
      this.CheckReportRequest(type, alertinfo.alertinfo, alertinfo.rptinfo, this.addOperList);
    },
    // 返回上报
    DangerCancel() {
      this.dialogDangerVisible = false;
      let row = this.$refs.xTableList.getCurrentRow();
      this.SetInfoByRow(row);
    },
    //危急值上报
    BatCheckDangerDeal(alertinfo, type) {
      this.BatCheckReportRequest(type, alertinfo.alertinfo, this.CheckRows[this.checkindex], this.addOperList)
        .then((res) => {
          let row = this.CheckRows[this.checkindex];
          let rckuser = !row.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernorhk : row.rechk_user;
          let rckusername = !row.rechk_username || this.specinuseflaginrecord == "2" ? this.exactusernamerhk : row.rechk_username;
          if (this.Options.rechkcoverechkuser == "1") {
            rckuser = this.exactusernorhk;
            rckusername = this.exactusernamerhk;
          }
          if (res.hasOwnProperty("checkca") && res.checkca == "1") {
            //CA信息保存先异步吧，和审核报告区分开来，就算签名失败也不影响审核，以免以后CA出故障导致一直无法审核报告
            this.logcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :开始电子签名: " + this.PatientInfo.reportid + "\r\n";
            //CA签名数据保存，不管成功或失败，都不影响审核 加密和保存加密数据都集成到CAsign方法
            this.ReportCheckCA(res, rckuser)
              .then(() => {
                this.CheckRows[this.checkindex].rechk_user = rckusername;
                this.CheckRows[this.checkindex].rechk_dt = this.selectdate;
                this.CheckRows[this.checkindex].cp_msg = "审核成功";
                this.checkindex++;
                this.checksuccess++;
                if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
                else this.AlertMsg();
              })
              .catch(() => {
                this.CheckRows[this.checkindex].rechk_user = rckusername;
                this.CheckRows[this.checkindex].rechk_dt = this.selectdate;
                this.CheckRows[this.checkindex].cp_msg = "审核成功,CA签名失败!";
                this.checkindex++;
                this.checkcafail++;
                if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
                else this.AlertMsg();
              });
          } else {
            if (this.Begincheckmode && this.batsignmode == "1") {
              this.CheckRows[this.checkindex].cp_msg = "签名成功";
              this.CheckRows[this.checkindex].rechkflag = "1";
            } else {
              this.CheckRows[this.checkindex].cp_msg = "审核成功";
              this.CheckRows[this.checkindex].rechk_user = rckusername;
              this.CheckRows[this.checkindex].rechk_dt = this.selectdate;
              this.CheckRows[this.checkindex].rechkflag = "9";
            }
            this.checkindex++;
            this.checksuccess++;
            if (this.checkindex < this.CheckRows.length) this.BeforeBatCheckReport(this.CheckRows[this.checkindex]);
            else this.AlertMsg();
          }
        })
        .catch(() => {
          if (this.Begincheckmode && this.batsignmode == "1") {
            this.CheckRows[this.checkindex].cp_msg = "签名失败";
          } else {
            this.CheckRows[this.checkindex].cp_msg = "审核失败";
          }

          this.checkindex++;
          this.checkfail++;
          if (this.checkindex < this.CheckRows.length) this.BeforeCheckReport(this.CheckRows[this.checkindex]);
          else this.AlertMsg();
        });
    },
    // #endregion 危急值上报弹窗

    // #region 指定为质控标本弹窗
    closeqcsampledialog(msg) {
      this.dialogToQcVisible = false;
      if (msg && msg != "") {
        this.$alert(msg);
      }
    },
    // #endregion 指定为质控标本弹窗

    // #region 回看式消息弹窗
    // 页面改变
    MsgCarouselChange(val) {
      // var oldindex = this.NowMsgNo - 0 - 1;
      // if (this.msglist[oldindex].hasOwnProperty("keycode") && this.msglist[oldindex].keycode) {
      //     var onemsg = this.InputMsg.filter((i) => i.keycode == this.msglist[oldindex].keycode);
      //     if (onemsg && onemsg.length > 0) onemsg[0].msg.content = this.inmsg;
      // }
      //delete by 吴露 2022/08/15 当输入消息在最后一个时，无法保存当前输入消息

      if (this.msglist[val].hasOwnProperty("keycode") && this.msglist[val].keycode) {
        var onemsg = this.InputMsg.filter((i) => i.keycode == this.msglist[val].keycode);
        if (onemsg && onemsg.length > 0) this.inmsg = onemsg[0].msg.content;
        else this.inmsg = "";
      }
      this.NowMsgNo = val - 0 + 1;
      this.msgtitle = this.msglist[val].title;
      if (this.NowMsgNo == this.TotalMsgNo) this.MsgAllOver = false;
    },
    // #endregion 指定为质控标本弹窗

    // #region 一览式消息弹窗
    // 表格样式
    ListMsgClassName({ row, rowIndex }) {
      if (row.kind == "错误") {
        return "fail";
      }
    },
    // 消息提示时保存输入的消息
    SaveInputMsg(keycode) {
      if (this.inmsg == "") {
        this.$alert("输入的内容不能为空!", "提示", {
          confirmButtonText: "确定",
        });
        return;
      }
      this.Submitdisabled = false;
      var onemsg = this.InputMsg.filter((i) => i.keycode == keycode);
      if (onemsg && onemsg.length > 0) onemsg[0].msg.content = this.inmsg;
    },
    // #endregion 一览式消息弹窗

    // #region 自动审核结论查询弹窗
    // 自动审核查看编辑
    AutochkReviewEdit() {
      if (this.similarflag != "1") {
        this.advicetype = "3";
        this.advicetxt = this.unsimilarreason;
        this.Queryautochkreview();
      } else {
        this.unsimilarreason = "";
      }
    },
    // 是否与人工相符
    similiarchange(val) {
      if (val == 2) this.$refs.autoreason.focus();
    },
    // #endregion 自动审核结论查询弹窗

    // #region 特殊患者关注项目提醒
    format({ cellValue, row, column }) {
      if (column.property == "deadline_dt") {
        return XE.toDateString(row[column.property], "yyyy-MM-dd");
      }
    },
    ColumnClassNameSpecial({ seq, row, rowIndex, $rowIndex, column }) {
      if (column.property == "concern_reason") {
        return "concern-reason";
      }
    },
    // #endregion 特殊患者关注项目提醒

    // #region 审核者注销弹窗
    //注销审核者点取消
    UnCheckUserAction() {
      this.exactusernorhk = "";
      this.exactusernamerhk = "";
      this.dialogUnCheckUserVisible = false;
    },
    //注销未审核的所有报告核对医生
    UnCheckUserAll() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "logoutrechkuser",
            rptunitid: this.rptunitid,
            sampledate: this.selectdate,
          },
        })
        .then((res) => {
          if (res.flag == "1") {
            this.$message.success("清除成功！");
            if (!this.UpdateJudge()) {
              this.PatientInfo.rechk_user = "";
              this.PatientInfo.rechk_username = "";
            }
            this.UnCheckUserAction();
          } else {
            this.$alert(res.msg, "错误");
          }
        });
    },
    // #endregion 审核者注销弹窗

    // #region 标记需复查弹窗
    SaveNeedRechk() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "saveredoflag",
            reportid: this.PatientInfo.reportid,
            tablestr: this.$refs.xTableRedo.tableFullData,
          },
        })
        .then((res) => {
          if (res.flag == "1") {
            this.$message({
              message: "标记需复查成功",
              type: "success",
            });
            this.dialogNeedRechkVisible = false;
            this.$refs.rmlabresult.QueryResult(this.PatientInfo).then((res) => {
              if (!res.hasOwnProperty("res")) {
                res.res = res;
                res.redo = "";
                res.history = 0;
              }
              this.Patredoflag = !!res.redo;
              this.PatHistoryNum = res.history;
              if (this.PRGNO == "LIS311") {
                if (res.iscontainBacteria) {
                  this.showPatHistoryNum = res.history;
                } else {
                  this.showPatHistoryNum = 0;
                }
              } else {
                this.showPatHistoryNum = res.history;
              }
              var row = XE.clone(res.res, true);
              this.PatientInfo = this.PatientInfoGetname(row);
              this.OldPatientInfo = this.PatientInfoGetname(row);
              this.AfterQResult(row.reportid, this);
              this.specno = res.sampleno ? res.sampleno : this.specno;
              if (row) {
                if (!this.specno) this.specno = row.sampleno;
                this.selectdate = row.sampledate;
              } else if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) {
                this.selectdate = this.sysdate + " 00:00:00";
              }
              this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
            });
          } else {
            this.$alert(res.msg, "错误");
          }
        });
    },
    // 复查样式
    RedoClass(redoflag) {
      var colorstr = "";
      switch (redoflag) {
        case "M":
          colorstr = this.Options.redoflagcolor ? this.Options.redoflagcolor : "yellow";
          break;
        case "2":
          colorstr = "rgb(00, 255, 00)";
          break;
        case "N":
          colorstr = "";
          break;
      }
      return colorstr;
    },
    // 设置复查标志
    SetRedoflag(redoflag) {
      let msg = "";
      switch (redoflag) {
        case "0":
          msg = "【重新计算】";
          break;
        case "M":
          msg = "【需复查】";
          break;
        case "2":
          msg = "【已复查】";
          break;
        case "N":
          msg = "【无需复查】";
          break;
        case "S":
          msg = "【外送复查】";
          break;
      }
      this.$confirm("是否将全部复查结果改为" + `<span style="font-weight:bold;color:blue;font-size:16px;">${msg}</span>`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        focusCancelButton: true,
        closeOnClickModal: false,
        dangerouslyUseHTMLString: true,
        type: "warning",
      }).then((then) => {
        for (let i = 0; i < this.$refs.xTableRedo.tableFullData.length; i++) {
          let row = this.$refs.xTableRedo.tableFullData[i];
          row.redo_flag = redoflag;
          if (!row.result2 && row.sflag == "1" && redoflag == "M") {
            row.result2 = row.dilutionrate;
          }
        }
      });
    },
    // 复查标志更改
    RedoflagChange(val, row) {
      if (!row.result2 && row.sflag == "1" && val == "M") {
        row.result2 = row.dilutionrate;
      }
    },
    //标记复查查询
    QueryNeedRechk() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "getredoflagpop",
            reportid: this.PatientInfo.reportid,
            sampleno: this.specno,
            rptunitid: this.rptunitid,
            sampledate: this.selectdate,
          },
        })
        .then((res) => {
          this.redoreasonoptions = res.redoreasonoptions;
          this.hasreasonoptionflag = this.redoreasonoptions.length > 0;
          if (res.data) {
            this.tableDataRedo = res.data;
            this.dialogNeedRechkVisible = true;
          } else {
            this.$alert("未查询到报告对应的报告项目!", "提示");
          }
        });
    },
    // #endregion 标记需复查弹窗

    // #region 批次审核弹窗
    QueryBatReport() {
      this.BatRechkloading = true;
      var date = new Date(this.BatRechkDate);
      date = date.setDate(date.getDate() + 1);
      date = new Date(date);
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "querybatreport",
            txtrptunit: this.rptunitid,
            txtsampleno: this.BatRechkSampleno,
            txtstarttime: XE.toDateString(this.BatRechkDate, "yyyy-MM-dd 00:00:00"),
            txtendtime: XE.toDateString(this.BatRechkDate, "yyyy-MM-dd 23:59:59"),
            pattype: this.BatRechkPatType,
            showredo: this.showRedo,
            sortArr: "[]",
          },
        })
        .then((response) => {
          this.BatRechkTableData = response.Data;
          this.BatRechkloading = false;
        })
        .catch((e) => {
          this.BatRechkloading = false;
          this.$message.warning(e);
        });
    },
    // 表格样式
    RechkClass({ row, column }) {
      if (column.property == "cp_msg") {
        if (row.cp_msg != "审核成功" && row.cp_msg != "") {
          return "fail";
        }
      }
    },
    // 执行批次审核
    BatchRechk() {
      this.checksuccess = 0;
      this.checkfail = 0;
      this.checkcafail = 0;
      if (this.isalwaysrechkuser == "1") {
        this.$rm_Login({
          type: "用户登录验证",
          btn: {
            confirmBtnText: "确定",
            cancelBtnText: "取消",
          },
        })
          .then((res) => {
            if (res.flag == "1") {
              //这里已经登录了，下面就不用再登录了
              if (this.batsignmode == "0") {
                this.exactusernorhk = res.userid;
                this.exactusernamerhk = res.username;
              } else {
                this.exactusernoreport = res.userid;
                this.exactusernamereport = res.username;
              }
              this.BatCheckReport(1);
            } else {
              //登录失败
            }
          })
          .catch((e) => {
          });
      }
      else {
        this.BatCheckReport(1);
      }
    },
    // 退出批次审核
    BatchCancel() {
      localStorage.setItem("ISAUTOPRINT", this.isautoprint);
      this.dialogBactchRechkVisible = false;
    },
    // #endregion 批次审核弹窗

    // #region 标本退回临床通知人弹窗
    //标本退回
    diagUserInfoChange(c, v, row) {
      this.Tellman = v;
      this.LPicData = [];
      this.reqrejectimage = "";
      this.dialogSmpCancelVisible = true;
    },
    // #endregion 标本退回临床通知人弹窗

    // #region 标本退回
    SampleCancelSubmit(c, v, row) {
      if (this.mustPhotoStr.indexOf('\'' + c + '\'') > -1 && !this.reqrejectimage) {
        //必须拍照
        this.$alert("选择的退回原因必须拍照，请拍照后再退回", "提示");
        return false;
      }
      this.CancelReason = v;
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "rejectbarcode",
            reportid: this.PatientInfo.reportid,
            barcode: this.PatientInfo.barcode,
            reject_reason: this.CancelReason,
            reject_userno: this.reject_userno,
            tellman: this.Tellman,
            reqrejectimage: this.reqrejectimage,
          },
        })
        .then((res) => {
          if (res.flag == "1") {
            this.$message.success("标本退回成功!");
            this.dialogCancelNotifierVisible = false;
            this.dialogSmpCancelVisible = false;
            this.$refs.rmlabresult.QueryResult(this.PatientInfo).then((res) => {
              if (!res.hasOwnProperty("res")) {
                res.res = res;
                res.redo = "";
                res.history = 0;
              }
              this.Patredoflag = !!res.redo;
              this.PatHistoryNum = res.history;
              if (this.PRGNO == "LIS311") {
                if (res.iscontainBacteria) {
                  this.showPatHistoryNum = res.history;
                } else {
                  this.showPatHistoryNum = 0;
                }
              } else {
                this.showPatHistoryNum = res.history;
              }
              var row = XE.clone(res.res, true);
              this.PatientInfo = this.PatientInfoGetname(row);
              this.OldPatientInfo = this.PatientInfoGetname(row);
              this.AfterQResult(row.reportid, this);
              this.specno = res.sampleno ? res.sampleno : this.specno;
              if (row) {
                if (!this.specno) this.specno = row.sampleno;
                this.selectdate = row.sampledate;
              } else if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) {
                this.selectdate = this.sysdate + " 00:00:00";
              }
              this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
            });
          } else if (res.flag == "-1") {
            this.$alert(res.msg, "提示");
          } else if (res.flag == "-99") {
            this.$confirm(res.msg, "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              focusCancelButton: false,
              closeOnClickModal: false,
              type: "warning",
            }).then(() => {
              this.ExecrejectBarcode();
            });
          }
        });
    },
    ExecrejectBarcode() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "execrejectbarcode",
            reportid: this.PatientInfo.reportid,
            barcode: this.PatientInfo.barcode,
            reject_reason: this.CancelReason,
            reject_userno: this.reject_userno,
            tellman: this.Tellman,
            reqrejectimage: this.reqrejectimage,
          },
        })
        .then((res) => {
          if (res.flag == "1") {
            this.$message.success("标本退回成功!");
            this.dialogCancelNotifierVisible = false;
            this.dialogSmpCancelVisible = false;
            this.$refs.rmlabresult.QueryResult(this.PatientInfo).then((res) => {
              if (!res.hasOwnProperty("res")) {
                res.res = res;
                res.redo = "";
                res.history = 0;
              }
              this.Patredoflag = !!res.redo;
              this.PatHistoryNum = res.history;
              if (this.PRGNO == "LIS311") {
                if (res.iscontainBacteria) {
                  this.showPatHistoryNum = res.history;
                } else {
                  this.showPatHistoryNum = 0;
                }
              } else {
                this.showPatHistoryNum = res.history;
              }
              var row = XE.clone(res.res, true);
              this.PatientInfo = this.PatientInfoGetname(row);
              this.OldPatientInfo = this.PatientInfoGetname(row);
              this.AfterQResult(row.reportid, this);
              this.specno = res.sampleno ? res.sampleno : this.specno;
              if (row) {
                if (!this.specno) this.specno = row.sampleno;
                this.selectdate = row.sampledate;
              } else if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) {
                this.selectdate = this.sysdate + " 00:00:00";
              }
              this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
            });
          } else if (res.flag == "-1") {
            this.$alert(res.msg, "提示");
          }
        });
    },
    // #endregion 标本退回

    // #region 报告单元选择弹窗
    poprptunitchange(rid, rname) {
      this.rptunitid = rid;
      this.oldrptunitid = rid;
      this.dialogUnitVisible = false;
      var pageinfo = this.$tool.getSession("RptPageInfo");
      if (pageinfo) {
        var pagearr = JSON.parse(pageinfo);
        if (pagearr) {
          pagearr.push({ id: this.$route.query.id, rptunitid: rid, path: this.$route.fullPath, multi: "" });
        }
        this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
      }

      this.GetOptions(this.rptunitid)
        .then(() => {
          this.pageinitloading = false;
          if (this.sysdate == "") {
            this.sysdate = this.Options.sysdate;
            this.selectdate = this.sysdate + " 00:00:00";
          } else {
            this.selectdate = this.sysdate + " 00:00:00";
          }

          this.QueryCol().then(() => {
            this.QueryList(1);
            //this.SettheRefreshRow(this.specno);
          });
        })
        .catch(() => {
          this.$pub.Log("未获取到报告单元对应选项!");
          this.pageinitloading = false;
        });
    },
    // 改变之前
    beforeChange(rid) {
      var pageinfo = this.$tool.getSession("RptPageInfo");
      if (pageinfo) {
        var pagearr = JSON.parse(pageinfo);
        if (pagearr) {
          //先看看有没有页面是选择的我的报告或本组报告
          var myreportpage = pagearr.find((item) => item.initrptunitid && item.initrptunitid != "")
          if (myreportpage) {
            //只有当选择的是原始报告单元时，才提示禁止打开，其他哪怕正选中的报告单元也可以打开
            if (myreportpage.initrptunitid == rid) {
              this.$alert("该报告单元是当前我的报告或本组报告的初始报告单元，无法重复选择!");
              return false;
            }
          } else {
            var page = pagearr.find((item) => item.rptunitid == rid);
            //没有我的报告或者本组报告时
            if (page) {
              this.btnCancel();
              this.$router.push({ path: page.path });
              // this.$alert("该报告单元已选择!");
              // return false;
            }
          }

          // var oneobj = pagearr.find(item => item.id == this.$route.query.id);
          // if (oneobj) {
          //     oneobj.rptunitid = rid;
          // } else {
          //     pagearr.push({ id: this.$route.query.id, rptunitid: rid, path: this.$route.fullPath, multi: "" });
          // }
          // this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
          // pagearr.push({ id: this.pageid, rptunitid: data.row.rptunitid, rptunitname: data.row.rptunitname, path: this.$route.fullPath });
          // this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
        }
        // this.rptunitid = data.row.rptunitid;
        // this.dialogUnitVisible = false;
        // this.$router.push("LIS310?id=" + this.pageid);
      }
      return true;
    },
    // 取消改变
    btnCancel() {
      this.dialogUnitVisible = false;
      this.$bus.$emit("close_current_tags");
      // if (this.pageid > 0) {
      //this.$router.go(-1);
      // }
      // this.rptunitid = 0;
    },
    // #endregion 报告单元选择弹窗

    // #region 解除审核弹窗
    //消息回看输入框双击事件，目前仅支持解除审核原因开窗选择
    msgDblClick(content, keycode) {
      if (keycode) this.inputkeycode = keycode;
      this.dialogUncheckReasonDataVisible = true;
    },
    // 原因输入
    uncheckInput(val) {
      if (val) this.SingleSubmitdisabled = false;
      else this.SingleSubmitdisabled = true;
    },
    // #endregion 解除审核弹窗

    // #region 解除原因选择弹窗
    Uncheckchange(code, name) {
      if (this.inputkeycode) {
        // var item = this.InputMsg.find(item => item.keycode == this.inputkeycode);
        // if (item) item.msg.content = name;
        this.unreasoncheckmsg = name;
        this.inmsg = name;
        this.SingleSubmitdisabled = false;
      }
      this.dialogUncheckReasonDataVisible = false;
    },
    // #endregion 解除原因选择弹窗

    // #region 文件导入弹窗
    fileChange() {
      this.importDialog = false;
      this.RefreshList();
    },
    // #endregion 文件导入弹窗

    // #region 报告单元设置弹窗
    configDefChange({ row, colcode }) {
      var selitem = this.tableDataColumn.find((item) => item.col_code == colcode);
      if (selitem) {
        var index = this.tableDataColumn.indexOf(selitem);
        if (row != "") {
          this.tableDataColumn[index].default_val = row.hidkey;
          this.tableDataColumn[index].default_valname = row.hidname;
        } else {
          this.tableDataColumn[index].default_val = "";
          this.tableDataColumn[index].default_valname = "";
        }
      }
      this.$refs.rmLabReportConfig.$refs.xTableColumn.loadData(this.tableDataColumn);
    },
    ConfigClose() {
      this.GetOptions(this.rptunitid).then(() => {
        this.QueryCol();
      });
    },
    // #endregion 报告单元设置弹窗

    // #region 已使用标本号弹窗
    //2021-09-29 查看已使用样本号
    showsampleDblClick({ row }) {
      this.specno = row.endno;
      this.SpecChangeAction(1);
      this.showsamplenoVisible = false;
    },
    // 刷新
    ShowInusedSampleno() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "showusedsampleno",
            rptunitid: this.rptunitid,
            sampledate: this.selectdate,
          },
        })
        .then((res) => {
          if (!res.hasOwnProperty("errcode")) {
            this.showsamplenoData = [];
            for (let i = 0; i < res.length; i++) {
              var samplenos = res[i].Item1;
              var samplearr = samplenos.split("-");
              var num = res[i].Item2;
              this.showsamplenoData.push({ startno: samplearr[0], endno: samplearr[1], num: num });
            }

            this.showsamplenoVisible = true;
          } else this.$confirm(res.errmsg, "错误");
        })
        .catch((err) => {
          console.log("instrdataerr:" + err);
        });
    },
    // #endregion 已使用标本号弹窗

    // #region 多选复用弹窗
    loadsqloption(val) {
      if (val.hasOwnProperty("errcode") || val.datatype == "") return;
      if (val.datatype == "Multi_reqitem") {
        if (val.data.length != this.reqitemOption.length) this.reqitemOption = val.data;
        this.reqitemloading = false;
      }
    },
    // #endregion 多选复用弹窗

    // #region 核收弹窗
    //核收项目
    CollectDeal() {
      this.SaveReportandResult(0, this.selectdate, this.rptunitid).then((r) => {
        var date = this.selectdate;
        if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3 || this.Options.batchbarcodeonlytoday == "1") {
          date = this.sysdate + " 00:00:00";
        }
        this.Options.sysdate = this.sysdate;
        this.$refs.rmLabReportCollect.CollectDeal(this.PRGNO, this.rptunitid, date, this.specno, this.Options.batchbarcodeonlytoday, this.Options);
      });
    },
    // #endregion 核收弹窗

    // #region 混样明细报告解除审核弹窗
    // 混样条码解除审核子条码执行解除和删除
    UnCheckReportMixData() {
      //mod 20210315 by 阳亮 都传到后台，后台判断是解除后删除还是直接删除
      //this.MixDatas = this.$refs.xTableMixDel.afterFullData.filter(item => item.rechkflag == "9");
      this.MixDatas = this.$refs.xTableMixDel.afterFullData;
      this.MixIndex = 0;
      if (this.MixDatas.length > 0) {
        this.UnCheckReportMix(this.MixDatas[this.MixIndex]);
      }
    },
    //混样条码解除审核子条码执行解除和删除
    UnCheckReportMix(row) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "uncheckmixreport",
            reportid: row.reportid,
          },
        })
        .then((res) => {
          if (res.flag == 1) {
            row.cp_msg = "解除成功";
            row.rechkflag = "0";
            if (++this.MixIndex < this.MixDatas.length) {
              this.UnCheckReportMix(this.MixDatas[this.MixIndex]);
            } else {
              this.loginsucessedflag = true;
              this.BeforeUnCheckReport(this.$tool.getSession(this.$tool.loginuserno));
            }
          } else {
            //=-1 错误消息的时候会进 catch
            this.ErrorListDeal(res.msg, res.flag)
              .then(() => {
                if (res.otherflag == 1) {
                  this.UnCheckReportOtherOper("", row);
                } else {
                  this.UnCheckReportMixExec(row);
                }
              })
              .catch(() => {
                // console.log("ErrorListDeal catch");
              });
          }
        })
        .catch(() => { });
    },
    // 混样条码解除审核子条码执行exec
    UnCheckReportMixExec(row) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "execuncheckmixreport",
            reportid: row.reportid,
            inputmsg: this.InputMsg,
          },
        })
        .then((res) => {
          if (res.flag == "1") {
            row.cp_msg = "解除成功";
            row.rechkflag = "0";
            if (++this.MixIndex < this.MixDatas.length) {
              this.UnCheckReportMix(this.MixDatas[this.MixIndex]);
            } else {
              this.loginsucessedflag = true;
              this.BeforeUnCheckReport(this.$tool.getSession(this.$tool.loginuserno));
            }
          } else {
            this.ErrorListDeal(res.msg, res.flag);
          }
        })
        .catch(() => { });
    },
    // #endregion 混样明细报告解除审核弹窗

    // #endregion 弹窗方法库


    // #region 悬浮窗

    // #region 所有悬浮窗关闭
    FloatClose(style, type) {
      //console.log("style",style);
      if (type == "1") {
        this.dialogimgfloatwindowVisible = false;
        this.floatwindowstyle1 = style.cssText;
        localStorage.setItem("floatwindowstyle1", this.floatwindowstyle1);
      } else if (type == "2") {
        this.dialogsampleimgfloatwindowVisible = false;
        this.floatwindowstyle2 = style.cssText;
        localStorage.setItem("floatwindowstyle2", this.floatwindowstyle2);
      } else if (type == "3") {
        this.dialogAdvicefloatwindowVisible = false;
        this.floatwindowstyle3 = style.cssText;
        localStorage.setItem("floatwindowstyle3", this.floatwindowstyle3);
      } else if (type == "4") {
        //按钮悬浮窗
        this.dialogbuttonfloatwindowVisible = false;
        this.floatwindowstyle4 = style.cssText;
        localStorage.setItem("floatwindowstyle4", this.floatwindowstyle4);
        localStorage.setItem("RM_LAB_REPORT_BUTTONFLOAT", this.dialogbuttonfloatwindowVisible ? "1" : "0");
        localStorage.setItem("RM_LAB_REPORT_BUTTONFLOAT_SHOWMODE", this.ButtonListflag ? "1" : "0");
      } else if (type == "5") {
        //异步审核悬浮窗
        this.synccheckvisible = false;
        this.floatwindowstyle5 = style.cssText;
        localStorage.setItem("floatwindowstyle5", this.floatwindowstyle5);
      } else if (type == "6") {
        //报告pdf悬浮窗
        this.reportpdfwindowVisible = false;
        this.floatwindowstyle6 = style.cssText;
        localStorage.setItem("floatwindowstyle6", this.floatwindowstyle6);
      }
    },
    // #endregion 所有悬浮窗关闭

    // #region 检验意见悬浮窗
    // 单击
    AdviceFloatClick({ row }) {
      if (this.txtadvice) {
        if (this.txtadvice.indexOf(row.txtinfo) == -1) {
          if (this.appendChangeRowFloat) {
            this.txtadvice += "\n" + row.txtinfo;
            this.PatientInfo[this.popdatatype.replace("LIS3_", "")] += "\n" + row.txtinfo;
          } else {
            if (this.txtadvice) {
              this.txtadvice += "," + row.txtinfo;
              this.PatientInfo[this.popdatatype.replace("LIS3_", "")] += "," + row.txtinfo;
            } else {
              this.txtadvice += row.txtinfo;
              this.PatientInfo[this.popdatatype.replace("LIS3_", "")] += row.txtinfo;
            }
          }
        }
      } else {
        this.txtadvice = row.txtinfo;
        this.PatientInfo[this.popdatatype.replace("LIS3_", "")] = row.txtinfo;
      }
    },
    // 双击
    AdviceFloatdblClick({ row }) {
      this.txtadvice = row.txtinfo;
      this.PatientInfo[this.popdatatype.replace("LIS3_", "")] = row.txtinfo;
    },
    // 检验意见输入时更新病人信息
    adviceinput(val) {
      this.PatientInfo[this.popdatatype.replace("LIS3_", "")] = val;
    },
    // 快速查找筛选
    AdviceSearchFloat(value) {
      if (value) {
        this.tableDataAdvice = this.tableDataAdviceAll.filter((item) => item.txttitle.toUpperCase().indexOf(value.toUpperCase()) > -1 || item.txtinfo.toUpperCase().indexOf(value.toUpperCase()) > -1 || item.inputcode.toUpperCase().indexOf(value.toUpperCase()) > -1);
      } else {
        this.tableDataAdvice = XE.clone(this.tableDataAdviceAll, true);
      }
    },
    // #endregion 检验意见悬浮窗

    // #region 按钮悬浮窗
    Buttonrowcolchange(val) {
      this.ButtonListflag = val;
    },
    // #endregion 按钮悬浮窗

    // #endregion 悬浮窗


    // #region 右侧tab页方法库

    // #region 切换tab
    handleTabClick(tab, event) {
      if (tab.label == "列表") {
        this.curtabindex = 1;
        if (!this.$refs.xTableList) {
          this.QueryList(0);
        }
      }
      if (tab.label == "图像") {
        this.curtabindex = 2;
        this.QueryImage();
      }
      if (tab.label.indexOf("历史结果") > -1) {
        this.curtabindex = 3;
        this.$nextTick(() => {
          this.QueryHistory();
        });
      }
      if (tab.label == "输入") {
        this.curtabindex = 4;
        this.QueryInputMdl();
      }
      if (tab.label == "申请") {
        this.curtabindex = 5;
        this.QueryApply();
        this.QueryApplyItem();
      }
      if (tab.label == "复查") {
        this.curtabindex = 6;
        this.QueryRechk();
      }
      if (tab.label == "通讯") {
        this.curtabindex = 7;
        this.QueryCommunite();
      }
      if (tab.label == "原始结果") {
        this.curtabindex = 10;
        this.QueryInstrData();
      }
      if (tab.label == "样本图像") {
        this.curtabindex = 12;
        this.QuerySampleImage();
      }
      if (tab.label == "待检样本") {
        this.curtabindex = 11;
        var searchfilter = JSON.parse(localStorage.getItem("ReportSmpFilter"));
        if (searchfilter) {
          this.sampledaysingle1 = searchfilter.day1;
          this.sampledaysingle2 = searchfilter.day2;
          this.sampledaysingle3 = searchfilter.day3;
          this.SmpSearchFilter.Stasusflag = searchfilter.Stasusflag;
          if (searchfilter.dt1) {
            if (searchfilter.todayflag == "1") {
              var odate = new Date(searchfilter.dt1);
              var medium = new Date(searchfilter.dt2) - new Date(searchfilter.dt1);
              var nowdate = XE.toDateString(new Date(), "yyyy-MM-dd") + XE.toDateString(searchfilter.dt2, " HH:mm:ss");
              this.samplerecievedt2 = nowdate;
              this.samplerecievedt1 = XE.toDateString(new Date(nowdate) - medium);
            } else {
              this.samplerecievedt1 = searchfilter.dt1;
              this.samplerecievedt2 = searchfilter.dt2;
            }
          } else {
            this.samplerecievedt1 = XE.toDateString(new Date(), "yyyy-MM-dd 00:00:00");
            this.samplerecievedt2 = XE.toDateString(new Date(), "yyyy-MM-dd 23:59:59");
          }
        } else {
          this.samplerecievedt1 = XE.toDateString(new Date(), "yyyy-MM-dd 00:00:00");
          this.samplerecievedt2 = XE.toDateString(new Date(), "yyyy-MM-dd 23:59:59");
        }

        this.QuerySample();
      }
      if (tab.label == "危急值项目") {
        this.curtabindex = 16;
        this.QueryAlteritemData();
      }
      if (tab.label == "混样明细") {
        this.curtabindex = 24;
        this.QuerymixDetail();
      }
      if (tab.label == "日志") {
        this.curtabindex = 25;
        this.QueryReportLog('tab');
      }
      if (tab.label == "仪器诊断") {
        this.tabinstrresult = this.PatientInfo.instr_advice;
      }
    },
    // #endregion 切换tab

    // #region 列表
    // 当前行选中
    currentListChangeEvent({ row, rowIndex }) {
      // this.SaveReportandResult(0, this.selectdate, this.rptunitid)
      //     .then((r) => {
      //         this.specno = row.sampleno + "";
      //         this.tempRowIndex = rowIndex;
      //         this.$refs.rmlabresult.QueryResult(row).then((res) => {
      //             this.AfterQResult();
      //             var row = XE.clone(res, true);
      //             this.PatientInfo = this.PatientInfoGetname(row);
      //             this.OldPatientInfo = this.PatientInfoGetname(row);
      //             this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
      //             var listrow = this.$refs.xTableList.tableFullData.filter((item) => item.reportid == row.reportid)[0];
      //             this.$refs.xTableList.setCurrentRow(listrow).then(() => {
      //                 this.$refs.xTableList.scrollToRow(listrow);
      //             });
      //         });
      //     })
      //     .catch(() => {
      //         // console.log("currentListChangeEvent          catch");
      //     });
    },
    // 排序变换
    ListSortChange({ triggerSort, column }) {
      this.CalcNum(this.$refs.xTableList.afterFullData);
    },
    // 排序后
    ListSortChangedEvent({ column, property, order }) {
      let datas = this.$refs.xTableList.afterFullData;
      if (datas.length > 0) {
        let row = datas[0];
        setTimeout(() => {
          this.$refs.xTableList.scrollToRow(row);
        }, 1);
      }
    },
    //右侧列表切换数据
    currentListClick({ row, rowIndex }) {
      //this.$refs.xTableList.setCurrentRow(row);
      if (this.PatientInfo.reportid != row.reportid) {
        this.SaveReportandResult(0, this.selectdate, this.rptunitid)
          .then((r) => {
            //清空一下病人信息和结果，防止有的时候反应慢，切换速度跟不上容易看错
            if (this.Options.switchreportreload == "1") {
              this.InitPatientInfo("changereportinit");
              this.$refs.rmlabresult.tableDataResult = [];
              if (this.Options.doubleresultcol == "1") this.$refs.rmlabresult.tableDataResult1 = [];
              //这里不可能出现在历史结果tab页的情况，因为tab页一直在列表，所以删除
            }

            this.specno = row.sampleno + "";
            this.tempRowIndex = rowIndex;
            this.$refs.rmlabresult.QueryResult(row).then((res) => {
              if (!res.hasOwnProperty("res")) {
                res.res = res;
                res.redo = "";
                res.history = 0;
              }
              this.Patredoflag = !!res.redo;
              this.PatHistoryNum = res.history;
              if (this.PRGNO == "LIS311") {
                if (res.iscontainBacteria) {
                  this.showPatHistoryNum = res.history;
                } else {
                  this.showPatHistoryNum = 0;
                }
              } else {
                this.showPatHistoryNum = res.history;
              }
              var rowdata = XE.clone(res.res, true);
              this.PatientInfo = this.PatientInfoGetname(rowdata);
              this.OldPatientInfo = this.PatientInfoGetname(rowdata);
              this.oldbarcode = rowdata.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
              this.AfterQResult(rowdata.reportid, this);
              // var listrow = this.$refs.xTableList.tableFullData.filter((item) => item.reportid == rowdata.reportid)[0];
              // this.$refs.xTableList.setCurrentRow(listrow).then(() => {
              //     this.$refs.xTableList.scrollToRow(listrow);
              // });
              this.specno = res.sampleno ? res.sampleno : this.specno;
              if (row) {
                if (!this.specno) this.specno = row.sampleno;
                this.selectdate = row.sampledate;
                //开启特殊患者关注项目提醒
                if (this.Options.specialpatconcernitemalert == "1") {
                  this.queryConcernItem(row.reportid);
                }
                //获取特殊标记
                this.Queryreportmark(row);
              } else if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) {
                this.selectdate = this.sysdate + " 00:00:00";
              }
              this.ChangeAsTab();
              this.AfterRefreshSetActive();
              this.GetBarcodeHasVal(row);//能够在列表进行选择的，都不是新加的标本了，这里要补一下标本添加标志为0
            });
          })
          .catch(() => {
            let oldrow = this.$refs.xTableList.tableFullData.find((item) => item.reportid == this.PatientInfo.reportid);
            if (oldrow) this.$refs.xTableList.setCurrentRow(oldrow);
            this.AfterRefreshSetActive();
            console.log("currentListChangeEvent          catch");
          });
      }
    },
    // 选择报告
    currentListSelect({ row }) {
      this.$refs.xTableList.setCurrentRow(row);
    },
    ListStyleName({ row, rowIndex }) {
      var pattype = "";
      var fontstylestr = "";
      var backstylestr = "";
      //分单类别中设置了整行样式的
      var reqinfo = this.reqgroupinfo.find((item) => item.req_groupid == row.req_groupid && item.showcolorcolumn == "2");
      if (reqinfo) {
        if (reqinfo.showcolormode == "2") {
          //字体颜色
          fontstylestr = "color:" + reqinfo.reportcolor + ";";
        } else if (reqinfo.showcolormode == "1") {
          //底色还需要考虑下面的各种状态
          backstylestr = "background-color:" + reqinfo.reportcolor + ";";
        }
      }
      //加急标本视为急诊标本
      if (row.emer_flag == "1") {
        pattype = "2";
      } else {
        pattype = row.pat_typecode;
      }
      //病人类型中设置了整行样式的
      var info = this.pattypeinfo.find((item) => item.pat_typecode == pattype && item.showcolorcolumn == "2");
      if (info) {
        if (info.showcolormode == "2") {
          //字体颜色
          fontstylestr = "color:" + info.color + ";";
        } else if (info.showcolormode == "1") {
          //底色还需要考虑下面的各种状态
          backstylestr = "background-color:" + info.color + ";";
        }
      }

      let stylestr = "background-color:";
      if (row.overtimeflag == "1") {
        //新加的需求要求已审核的也保留超时标志，如果是已审核，颜色还是按照已审核的底色来
        return fontstylestr + stylestr + (row.rechkflag == "9" ? this.Options.previewrowshowcolor : this.Options.overtimerowshowcolor);
      }
      if (row.printflag > 0) {//已打印
        return fontstylestr + stylestr + this.Options.printrowshowcolor;
      } else if (row.rechkflag == "9") {//已审核
        return fontstylestr + stylestr + this.Options.previewrowshowcolor;
      } else if (row.rechkflag == "1") {//已签名
        return fontstylestr + stylestr + "#d3bde2";
      } else if (row.prechkflag == "1") {//待审核
        //如果待审核是白底色（默认），当没设置看
        if (this.Options.pendingrowshowcolor && this.Options.pendingrowshowcolor != "#FFFFFF") {
          return fontstylestr + stylestr + this.Options.pendingrowshowcolor;
        } else {
          return fontstylestr + backstylestr;
        }
      } else {
        return fontstylestr + backstylestr;
      }
    },
    ReportListClass(row, column) {
      var stylestr = "";
      if (column == "req_groupname") {
        var reqinfo = this.reqgroupinfo.find((item) => item.req_groupid == row.req_groupid && item.showcolorcolumn == "1");
        if (reqinfo) {
          //字体颜色
          if (reqinfo.showcolormode == "2") {
            stylestr = "color:" + reqinfo.reportcolor + ";";
          } else if (reqinfo.showcolormode == "1") { //底色
            stylestr = "background-color:" + reqinfo.reportcolor + ";";
          }
        }
      } else if (column == "pat_name") {
        var pattype = "";
        //加急标本视为急诊标本
        if (row.emer_flag == "1") {
          pattype = "2";
        } else {
          pattype = row.pat_typecode;
        }
        var info = this.pattypeinfo.find((item) => item.pat_typecode == pattype && item.showcolorcolumn == "1");
        if (info) {
          //字体颜色
          if (info.showcolormode == "2") {
            stylestr = "color:" + info.color + ";";
          } else if (info.showcolormode == "1") { //底色
            stylestr = "background-color:" + info.color + ";";
          }
        } else if (row.emer_flag == "1") {
          //如果急诊标本未设置颜色，设置为红色字体
          stylestr = "color:red;";
        }
      }
      return stylestr;
    },
    // 报告标记修改开启
    DataActive({ column, row }) {
      if (column.property == "markno") {
        this.mmarkflag = XE.clone(row.markno, true);
        this.mredoflag = XE.clone(row.redo_flag, true);
        if (this.mredoflag == "1") this.mredoflagname = "需复查";
        else if (this.mredoflag == "2") this.mredoflagname = "已复查";
        else this.mredoflagname = "";
        this.Queryreportmark(row);
        this.markvisible = true;
      }
    },
    // 报告标记修改关闭
    DataCloesd({ row, column }) {
      if (this.markvisible) {
        this.markvisible = false;
      }
    },
    // 快速检索过滤
    async listsearch() {
      this.$refs.listsearchinput.select();
      var val = this.listsearchkey;
      if (val.indexOf("-") > -1) {
        let numarr = [];
        numarr[0] = val.substring(0, val.indexOf("-"));
        numarr[1] = val.substring(val.indexOf("-") + 1);
        if (!numarr[1]) {
          numarr[1] = numarr[1].padStart(20, "9");
        }
        this.tableDataListS = this.tableDataList.filter((item) => item.sampleno.padStart(20, " ") >= numarr[0].padStart(20, " ") && item.sampleno.padStart(20, " ") <= numarr[1].padStart(20, " "));
      } else {
        let barcodetranstr = await this.$tool.request({ url: "LIS/LIS3/LIS310", method: "post", data: { action: "barcodeTran", barcode: val.toUpperCase(), } });
        this.tableDataListS = this.tableDataList.filter((item) => {
          return (item.pat_name && item.pat_name.toUpperCase().indexOf(val.toUpperCase()) > -1) || (item.barcode && item.barcode.toUpperCase().indexOf(barcodetranstr) > -1) || (item.pat_no && item.pat_no.toUpperCase().indexOf(val.toUpperCase()) > -1) || (item.req_reason && item.req_reason.toUpperCase().indexOf(val.toUpperCase()) > -1) || (item.patname_py && item.patname_py.toUpperCase().indexOf(val.toUpperCase()) > -1);
        });
      }

      this.CalcNum(this.tableDataListS);
      //筛选后选中第一条并且左侧信息同步切换
      if (this.tableDataListS.length > 0) {
        this.$refs.xTableList.setCurrentRow(this.tableDataListS[0]);
        this.currentListClick({ row: this.tableDataListS[0], rowIndex: 0 });
      }

    },
    // 双击筛选出只有当前名人姓名、送检目的和标本类型的报告
    ListDblClick({ row, rowIndex, $rowIndex, column }) {
      if (column.property == "pat_name" && this.Options.doublefilterpatname > 0) {
        this.tableDataListS = this.tableDataList.filter((item) => item.pat_name == row.pat_name);
      }
      if (column.property == "req_reason" && this.Options.doublefilterrs > 0) {
        this.tableDataListS = this.tableDataList.filter((item) => item.req_reason == row.req_reason);
      }
      if (column.property == "specimen_code" && this.Options.doublefilterrs > 0) {
        this.tableDataListS = this.tableDataList.filter((item) => item.specimen_code == row.specimen_code);
      }
    },
    // 当前已有报告标记变换
    ChangeMark(type) {
      if (type == 3) {
        this.mmarkflag = "";
      } else if (type == 2) {
        this.mspecialflag = "";
        this.mspecialflagname = "";
      } else if (type == 1) {
        this.mredoflag = "0";
        this.mredoflagname = "";
      }
    },
    // 取消标记
    MarkClose({ row, column }, type) {
      var markname = this.mmarkflag;
      var redo = this.mredoflag;
      var pattype = this.mspecialflag;
      if (row.markno && markname == "") {
        this.$rm_Login({
          type: "取消标记确认",
          btn: {
            confirmBtnText: "确定",
            cancelBtnText: "取消",
          },
        }).then((res) => {
          if (res.flag == "1") {
            this.PatientInfo.markno = markname;
            row.markno = markname;
            //this.SaveReportandResult(1, this.selectdate, this.rptunitid, "", 1).then(() => {
            this.SaveReportMark(markname, res.userid, redo, pattype, row.reportid);
            //});
            if (type != 4) this.markvisible = false;
          }
        });
      } else {
        this.PatientInfo.markno = markname;
        row.marno = markname;
        var user = this.$tool.getSession(this.$tool.loginuserno);
        //this.SaveReportandResult(0, this.selectdate, this.rptunitid, "", 1).then(() => {
        this.SaveReportMark(markname, user, redo, pattype, row.reportid);
        //});
        if (type != 4) this.markvisible = false;
      }
    },
    // 标记聚焦
    Markfocus(row) {
      if (!this.markvisible) {
        //this.mmarkflag = XE.clone(row.markno, true);
        this.mredoflag = XE.clone(row.redo_flag, true);
        if (this.mredoflag == "1") this.mredoflagname = "需复查";
        else if (this.mredoflag == "2") this.mredoflagname = "已复查";
        else this.mredoflagname = "";
        this.Queryreportmark(row);
        this.markvisible = true;
      }
    },
    Exceptionfocus(row) {
      if (this.Options.showmultiitemrule == "1" && row.exceptionflag == "1") {
        if (!this.exceptionvisible) {
          this.Querymultiitemdetail(row);
          this.exceptionvisible = true;
        }
      }
    },
    Exceptionblur() {
      this.exceptionvisible = false;
      this.multiitemData = [];
    },
    // 选择标记
    tagclick(val, name, type, row) {
      if (type == "specialtype") {
        this.mspecialflag = val;
        this.mspecialflagname = name;
        ///this.MarkClose({ row }, 4);
      } else if (type == "mark") {
        this.mmarkflag = val;
        //this.MarkClose({ row }, 4);
      } else if (type == "redoflag") {
        if (row.rechkflag != "9" && row.rechkflag != "1") {
          this.mredoflag = val;
          this.mredoflagname = name;
        }
      }
    },
    //分页点击页码查询
    handlePageChange({ currentPage, pageSize }) {
      this.tableListPage.currentPage = currentPage;
      this.tableListPage.pageSize = pageSize;
      this.QueryList(1);
    },
    // 删除报告
    DelReport(mode) {
      this.loginusercode = "";
      this.loginusername = "";
      this.loginuserpwd = "";
      this.delreason = "";
      var nowrow = this.$refs.xTableList.afterFullData.filter((item) => item.reportid == this.PatientInfo.reportid);
      if (nowrow.length > 0) {
        var index = this.$refs.xTableList.afterFullData.indexOf(nowrow[0]);
        var nextindex = index - 0 - 1;
        if (nextindex < 0) nextindex = index - 0 + 1;
        var nextrow = { sampleno: "1", rptunitid: this.rptunitid, sampledate: this.selectdate };
        if (this.$refs.xTableList.afterFullData.length > 1) nextrow = this.$refs.xTableList.afterFullData[nextindex];
        if (this.Options.loginwhendelete == "1") {//验证工号密码
          this.$rm_Login({
            type: "删除报告登录确认",
            btn: {
              confirmBtnText: "确定",
              cancelBtnText: "取消",
            },
          }).then((res) => {
            if (res.flag == "1") {
              this.DelAction(nowrow[0], nextrow, mode, res.userid);
            }
          });
        } else if (this.Options.loginwhendelete == "2") {//输入删除原因
          this.loginreasontitle = "输入删除原因";
          this.$refs.loginreasoninput
            .ShowDialog()
            .then(() => {
              this.DelAction(nowrow[0], nextrow, mode, "");
            })
            .catch(() => {
              this.delreason = "";
            });
          this.dialogLoginReasonVisible = true;
        } else if (this.Options.loginwhendelete == "3") {//工号验证和删除原因都要输入
          this.loginreasontitle = "输入工号密码和删除原因";
          this.$refs.loginreasoninput
            .ShowDialog()
            .then(() => {
              this.DelAction(nowrow[0], nextrow, mode, this.loginusercode);
            })
            .catch(() => {
              this.loginusercode = "";
              this.loginusername = "";
              this.loginuserpwd = "";
              this.delreason = "";
            });
        } else {//无操作
          this.DelAction(nowrow[0], nextrow, mode, "");
        }
      }
    },
    // 执行删除
    DelAction(row, nextrow, mode, userno) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "deletereport",
            reportid: row.reportid,
            rptunitid: nextrow.rptunitid,
            sampledate: nextrow.sampledate,
            sampleno: nextrow.sampleno,
            mode: mode,
            userno: userno,
            delreason: this.delreason,
            userpwd: md5("rms-" + this.loginuserpwd + "-rme"),
          },
        })
        .then((res) => {
          if (res.flag == 1) {
            this.$message({
              message: "删除成功",
              type: "success",
            });
            this.dialogDelVisible = false;
            var queryrow = { reportid: "" };
            if (mode == "3" || mode == "2") {
              queryrow = this.PatientInfo;
            } else {
              queryrow = nextrow;
              this.$refs.xTableList.remove(row).then(() => {
                if (row.reportid) {
                  this.tableDataListS = this.tableDataListS.filter((item) => item.reportid != row.reportid);
                  this.tableDataList = this.tableDataList.filter((item) => item.reportid != row.reportid);
                }
                this.$refs.xTableList.updateAfterFullData();
                setTimeout(() => {
                  this.$refs.xTableList.scrollToRow(nextrow);
                  this.$refs.xTableList.setCurrentRow(nextrow);
                }, 1);
              });
            }
            this.GetBarcodeHasVal(queryrow);
            this.$refs.rmlabresult.QueryResult(queryrow).then((res) => {
              if (!res.hasOwnProperty("res")) {
                res.res = res;
                res.redo = "";
                res.history = 0;
              }
              this.Patredoflag = !!res.redo;
              this.PatHistoryNum = res.history;
              if (this.PRGNO == "LIS311") {
                if (res.iscontainBacteria) {
                  this.showPatHistoryNum = res.history;
                } else {
                  this.showPatHistoryNum = 0;
                }
              } else {
                this.showPatHistoryNum = res.history;
              }
              var row = XE.clone(res.res, true);
              this.PatientInfo = this.PatientInfoGetname(row);
              this.OldPatientInfo = this.PatientInfoGetname(row);
              this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
              this.specno = res.sampleno ? res.sampleno : this.specno;
              if (row) {
                if (!this.specno) this.specno = row.sampleno;
                this.selectdate = row.sampledate;
              } else if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) {
                this.selectdate = this.sysdate + " 00:00:00";
              }
              if (this.prgno == "LIS311") this.$refs.rmlabresult.QueryMed();
              this.AfterRefreshSetActive();
            });
          } else {
            if (res.hasOwnProperty("errmsg")) {
              this.$alert(res.errmsg, "错误", {
                confirmButtonText: "确定",
              });
            } else {
              this.$alert(res.msg, "错误", {
                confirmButtonText: "确定",
              });
            }
          }
        });
    },
    // 刷新按钮
    RefreshList() {
      var tempspecno = this.specno;
      this.CheckRows = [];
      this.checksuccess = 0;
      this.checkfail = 0;
      this.SaveReportandResult(3, this.selectdate, this.rptunitid)
        .then((r) => {
          //this.QueryCol();
          this.QueryList(3).then(() => {
            this.tooltipsdiable = false;
            //this.SettheRefreshRow(tempspecno);
          });
        })
        .catch(() => {
          //this.QueryCol();
          this.QueryList(3).then(() => {
            this.tooltipsdiable = false;
            //this.SettheRefreshRow(tempspecno);
          });
        });
    },
    // 筛选条件确定
    StatuChange(e) {
      if (e == 1) {
        this.listStatus = "";
        if (this.myreport) this.listStatus += "我的报告(所有),";
        if (this.mygreport) this.listStatus += "本组报告,";
        if (this.myunitreport) this.listStatus += "我的报告(当前单元),";
        var filter = this.rptunitgroupfilter.find(item => item.rptunitgroupid == this.rptunitgroup);
        if (filter) this.listStatus += (filter.rptunitgroupname + ",");
        for (var key in this.ListSearchFilter) {
          if (this.ListSearchFilter[key] && this.ListSearchFilter[key] != "全部") {
            if (key == "Custom") {
              this.listStatus += this.ListSearchFilter.Custom + ",";
            } else {
              this.listStatus += this.ListSearchFilter[key] + ",";
            }
          }
        }
        if (this.ListSearchpattype != "全部") {
          this.listStatus += this.ListSearchpattype + ",";
        }
        if (this.ListSearchOtherflag != "全部") {
          this.listStatus += this.ListSearchOtherflag + ",";
        }
        if (this.listStatus) this.listStatus = this.listStatus.substring(0, this.listStatus.length - 1);
        this.filtervisible = false;
        this.QueryList(0);
      } else {
        this.SmpStatus = "已采样未上机";
        for (var key in this.SmpSearchFilter) {
          if (this.SmpSearchFilter[key] && this.SmpSearchFilter[key] != "已采样未上机") {
            this.SmpStatus += this.SmpSearchFilter[key] + ",";
          }
        }
        if (this.SmpStatus) this.SmpStatus = this.SmpStatus.substring(0, this.SmpStatus.length - 1);
        this.filtervisibleSmp = false;
        this.QuerySample();
      }
    },
    // 清除筛选条件
    CancelFilter() {
      this.filtervisible = false;
      this.filtervisibleSmp = false;
    },
    //审核模式输入框
    Checkmodefocus() {
      this.checkmodefous = true;
    },
    // 失焦
    Checkmodeblur() {
      this.checkmodefous = false;
    },
    // 双击失败报告再次审核
    checkmodeDbl(row) {
      if (row.cp_msg.indexOf("失败") > -1) {
        this.CheckReport();
      }
    },
    // 报告标记更改
    SaveReportMark(markno, user, redoflag, pattype, reportid) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "savereportmark",
            reportid: reportid,
            markno: markno,
            redoflag: redoflag,
            pattype: pattype,
            markuser: user ? user : this.$tool.getSession(this.$tool.loginuserno),
          },
        })
        .then((res) => {
          if (res.hasOwnProperty("flag") && res.flag == "1") {
            let row = this.$refs.xTableList.getCurrentRow();
            this.SetInfoByRow(row);
            if (res.dt && res.dt.length > 0) {
              this.mspecialretdata = res.dt;
              this.specialretdataVisible = true;
            }
            this.Queryreportmark(row);
          } else this.$confirm("报告标记失败", "提示");
        })
        .catch((err) => {
          console.log("instrdataerr:" + err);
        });
    },
    // #endregion 列表

    // #region 复查
    CurrentRechkChange({ row }) {
      this.tableDataRechkDetail = this.tableDataRechkDetailAll.filter((item) => item.cp_seq == row.cnt);
      this.$refs.xTableRechkDetail.setCurrentRow(this.tableDataRechkDetail[0]);
    },
    // 双击采用本次的复查结果作为报告结果（上面的）
    RechkDblClick({ row }) {
      if (this.PatientInfo["rechkflag"] == "9" || (this.Options.onlymodifymyreport == "1" && this.$tool.getSession(this.$tool.loginuserno) != this.PatientInfo["report_user"]) || (this.PatientInfo.barcode && this.PatientInfo.barcode.indexOf("-退") > -1)) {
        return;
      } else {
        this.$confirm("你是否要采用本次的复查结果作为报告结果?<br/>选择【是(Y)】则采用本次复查后结果<br/>选择【否(N)】则采用本次复查前结果<br/>选择【×】则不做任何操作", "提示", {
          confirmButtonText: "是    （Y）",
          cancelButtonText: "否    （N）",
          distinguishCancelAndClose: true,
          dangerouslyUseHTMLString: true,
          focusCancelButton: true,
          closeOnClickModal: false,
          type: "warning",
        })
          .then(() => {
            if (this.tableDataRechkDetail.length > 0) {
              for (let i = 0; i < this.tableDataRechkDetail.length; i++) {
                var itemrow = this.$refs.rmlabresult.$refs.xTableResult.tableFullData.filter((item) => item.rpt_itemcode == this.tableDataRechkDetail[i].rpt_itemcode);
                if (itemrow.length > 0) {
                  //要把当前检验结果设置成复查前结果
                  itemrow[0].redo_result = itemrow[0].result_str;
                  itemrow[0].result_str = this.tableDataRechkDetail[i].newvalue;
                }
              }
            }
          })
          .catch((action) => {
            if (action == "cancel") {
              if (this.tableDataRechkDetail.length > 0) {
                for (let i = 0; i < this.tableDataRechkDetail.length; i++) {
                  var itemrow = this.$refs.rmlabresult.$refs.xTableResult.tableFullData.filter((item) => item.rpt_itemcode == this.tableDataRechkDetail[i].rpt_itemcode);
                  if (itemrow.length > 0) {
                    //要把当前检验结果设置成复查前结果
                    itemrow[0].redo_result = itemrow[0].result_str;
                    itemrow[0].result_str = this.tableDataRechkDetail[i].oldvalue;
                  }
                }
              }
            }
          });
      }
    },
    // 双击采用本次的复查后结果作为报告结果（下面的）
    RechkDetailDblClick({ row, rowIndex, $rowIndex, column }) {
      if (this.PatientInfo["rechkflag"] == "9" || (this.Options.onlymodifymyreport == "1" && this.$tool.getSession(this.$tool.loginuserno) != this.PatientInfo["report_user"]) || (this.PatientInfo.barcode && this.PatientInfo.barcode.indexOf("-退") > -1)) {
        return;
      } else {
        var itemrow = this.$refs.rmlabresult.$refs.xTableResult.tableFullData.filter((item) => item.rpt_itemcode == row.rpt_itemcode);
        if (itemrow.length > 0) {
          if (column.property == "newvalue") {
            this.$confirm("你是否要采用本次的复查后结果作为报告结果?", "提示", {
              confirmButtonText: "作为检验结果",
              cancelButtonText: "作为历史结果",
              distinguishCancelAndClose: true,
              focusCancelButton: true,
              closeOnClickModal: false,
              type: "warning",
            })
              .then(() => {
                itemrow[0].result_str = row.newvalue;
              })
              .catch(() => {
                itemrow[0].redo_result = row.newvalue;
              });
          }
          if (column.property == "oldvalue") {
            this.$confirm("你是否要采用本次的复查前结果作为报告结果?", "提示", {
              confirmButtonText: "作为检验结果",
              cancelButtonText: "作为历史结果",
              distinguishCancelAndClose: true,
              closeOnClickModal: false,
              focusCancelButton: true,
              type: "warning",
            })
              .then(() => {
                itemrow[0].result_str = row.oldvalue;
              })
              .catch(() => {
                itemrow[0].redo_result = row.oldvalue;
              });
          }
        } else {
          this.$confirm("检验项目中没有对应选择项目!", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            focusCancelButton: true,
            closeOnClickModal: false,
            type: "warning",
          });
        }
      }
    },
    // 复查查询
    QueryRechk() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "redoinfo",
            reportid: this.PatientInfo.reportid,
          },
        })
        .then((res) => {
          this.DealRechkData(res);
        })
        .catch((error) => {
          this.$confirm(error, "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            focusCancelButton: true,
            closeOnClickModal: false,
            type: "warning",
          });
        });
    },
    // 复查结果赋值
    DealRechkData(res) {
      this.canUpdateRedoResultflag = res.canUpdateRedoResultflag;
      this.tableColumnRechkDetail = res.Cols;
      this.tableDataRechk = res.cntlist;
      this.tableDataRechkDetailAll = res.alldatalist;
      if (res.alldatalist.length > 0 && res.cntlist.length > 0) {
        this.tableDataRechkDetail = this.tableDataRechkDetailAll.filter((item) => item.cp_seq == res.cntlist[0].cnt);
        this.$refs.xTableRechk.setCurrentRow(res.cntlist[0]);
        this.$refs.xTableRechkDetail.setCurrentRow(this.tableDataRechkDetail[0]);
      } else {
        this.tableDataRechkDetail = [];
      }
    },
    // 修改复查结果前
    BeforeRechkDetailDelete(type) {
      if ((this.tableDataRechk.length == 0 && type == 1)
        || (this.tableDataRechkDetail.length == 0 && type == 2)) {
        this.$alert("无可删除的结果！", "提示");
        return;
      }

      if (!this.redomodifyloginsuccessflag) {
        this.$rm_Login({
          type: "用户登录验证用于确认修改复查结果人员",
          btn: {
            confirmBtnText: "确定",
            cancelBtnText: "取消",
          },
        })
          .then((res) => {
            if (res.flag == "1") {
              this.redomodifyloginsuccessflag = true;
              //登录成功
              this.RechkDetailDelete(res.userid, type);
            } else {
              //登录失败
              this.$message.error("用户登录失败");
            }
          })
          .catch((e) => { });
      }
      else {
        this.RechkDetailDelete(this.$tool.getSession(this.$tool.loginuserno), type);
      }
    },
    // 修改复查前结果
    redoresultchange({ row }) {
      if (!this.redomodifyloginsuccessflag) {
        this.$rm_Login({
          type: "用户登录验证用于确认修改复查结果人员",
          btn: {
            confirmBtnText: "确定",
            cancelBtnText: "取消",
          },
        })
          .then((res) => {
            if (res.flag == "1") {
              this.redomodifyloginsuccessflag = true;
              //登录成功
              this.RechkDetailUpdate(res.userid, row);
            } else {
              //登录失败
              this.$message.error("用户登录失败");
            }
          })
          .catch((e) => { });
      }
      else {
        this.RechkDetailUpdate(this.$tool.getSession(this.$tool.loginuserno), row);
      }
    },
    // 更新复查结果
    RechkDetailUpdate(userno, row) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "updateredoinput",
            reportid: this.PatientInfo.reportid,
            rpt_logid: row.rpt_logid,
            rpt_itemcode: row.rpt_itemcode,
            oldvalue: row.oldvalue,
            userno: userno,
            isallowsync: this.isallowsync,
          },
        })
        .then((res) => {
          if (res.flag == "1") {
            this.$message({
              type: "success",
              message: "修改成功",
            });
            if (this.isallowsync == "1") {
              var itemrow = this.$refs.rmlabresult.$refs.xTableResult.tableFullData.filter((item) => item.rpt_itemcode == row.rpt_itemcode);
              if (itemrow.length > 0) {
                itemrow[0].redo_result = row.oldvalue;
              }
            }
          } else {
            this.$message({
              type: "error",
              message: res.msg,
            });
          }
        })
        .catch(() => {
          this.$message({
            type: "error",
            message: "修改失败",
          });
        });
    },
    // 删除复查结果
    RechkDetailDelete(userno, type) {
      //获取当前行
      if (this.tableDataRechk.length > 0 && this.tableDataRechkDetail.length > 0) {
        let cntrow = this.$refs.xTableRechk.getCurrentRow();
        if (!cntrow) {
          this.$message.warning("请选择要删除的行！");
          return;
        }
        let row = this.$refs.xTableRechkDetail.getCurrentRow();
        if (!row) {
          this.$message.warning("请选择要删除的明细结果！");
          return;
        }
        let msg = "";
        if (type == 1) {
          msg = "确定删除复查时间为【" + `<span style="font-weight:bold;color:blue;font-size:16px;">${cntrow.datestr}</span>` + "】的所有复查结果吗？";
        } else {
          msg = "确定删除项目名称为【" + `<span style="font-weight:bold;color:blue;font-size:16px;">${row.rpt_itemname}</span>` + "】的复查结果吗？";
        }
        //提示确认是否删除
        this.$confirm(msg, "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          dangerouslyUseHTMLString: true,
          type: "warning",
        })
          .then(() => {
            this.$tool
              .request({
                url: "LIS/LIS3/LIS310",
                method: "post",
                data: {
                  action: "deleteredoinput",
                  reportid: this.PatientInfo.reportid,
                  rpt_logid: row.rpt_logid,
                  rpt_itemcode: row.rpt_itemcode,
                  userno: userno,
                  deltype: type,
                },
              })
              .then((res) => {
                if (res.flag == "1") {
                  this.$message({
                    type: "success",
                    message: "删除成功",
                  });
                  if (type == 1) {
                    this.QueryRechk();
                  } else {
                    this.tableDataRechkDetail.splice(this.tableDataRechkDetail.indexOf(row), 1);
                    this.tableDataRechkDetailAll.splice(this.tableDataRechkDetailAll.indexOf(row), 1);
                    //把第一行设置成当前行
                    if (this.tableDataRechkDetail.length > 0) {
                      this.$refs.xTableRechkDetail.setCurrentRow(this.tableDataRechkDetail[0]);
                    } else {
                      this.QueryRechk();
                    }
                  }
                } else {
                  this.$message({
                    type: "error",
                    message: res.msg,
                  });
                }
              })
              .catch(() => {
                this.$message({
                  type: "error",
                  message: "删除失败",
                });
              });
          })
          .catch((e) => { });
      } else {
        this.$message({
          type: "error",
          message: "没有可删除的复查结果",
        });
      }
    },
    // #endregion 复查

    // #region 待检样本
    SmpClassName({ row, rowIndex }) {
      if (row.hid == "1") {
        return "rm-hid";
      }
      else if (row.rechkflag != "" && row.rechkflag != "9" && row.rechkflag != null) {
        return "warn-low";
      } else if (row.rechkflag == "9") {
        return "printrpt";
      }
    },
    // 核收到当前样本号
    CollectToCurSpecno() {
      let currow = this.$refs.xTableSmp.getCurrentRow();
      if (currow) {
        this.SampleToRpt({ row: currow });
      } else {
        this.$alert("请先选择一条待检样本！", "提示");
      }
    },
    // 核收
    SampleToRpt({ row }) {
      //双击result添加模板对应报告项目
      this.$confirm("是否要将本条码核收到日期：" + this.selectdate + "报告单元：" + this.rptunitid + "样本号：" + this.specno, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        focusCancelButton: false,
        closeOnClickModal: false,
        type: "warning",
      }).then(() => {
        if (this.PatientInfo.barcode) {
          this.$alert("已经有信息禁止条码覆盖，取消核收", "错误");
          return false;
        } else {
          this.PatientInfo.barcode = row.barcode;
          this.changekeyflag = true;
          this.ExecBarcodeChange()
            .then(() => {
              this.CheckSamples(this.barcodePatientInfo);
              this.changekeyflag = false;
              //this.QuerySample();
            })
            .catch(() => {
              this.changekeyflag = false;
              //this.QuerySample();
            });

        }
      }).catch(() => {

      });
    },
    //查询待检报告
    QuerySample() {
      this.loadingSmp = true;
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "querysample",
            rptunitid: this.rptunitid,
            date1: this.sampledaysingle1,
            date2: this.sampledaysingle2,
            date3: this.sampledaysingle3,
            searchfilter: this.SmpSearchFilter.Stasusflag,
            workonmachine: this.workonmachine,
            searchtxt: this.samplesearchtxt,
            reqdetail: this.reqitem,
          },
        })
        .then((res) => {
          this.loadingSmp = false;
          if (res && !res.hasOwnProperty("errcode") && res.sampledt) {
            //this.tableDataSmpAll = res.sampledt;
            this.tableDataSmpCount = res.sampledt.length;
            this.tableDataSmp = res.sampledt;
            this.$refs.xTableSmp.loadData(this.tableDataSmp);
          } else {
            //this.tableDataSmpAll = [];
            this.tableDataSmp = [];
            this.tableDataSmpCount = 0;
          }
          this.SaveLocalReportSmpFilter();
        })
        .catch((error) => {
          this.loadingSmp = false;
          this.$message.error("错误1:" + error);
        });
    },
    // 本地保存待检样本条件
    SaveLocalReportSmpFilter() {
      var todayflag = XE.toDateString(new Date(), "yyyy-MM-dd") == XE.toDateString(this.samplerecievedt2, "yyyy-MM-dd") ? "1" : "0";
      var smpfilter = { day1: this.sampledaysingle1, day2: this.sampledaysingle2, day3: this.sampledaysingle3, dt1: this.samplerecievedt1, dt2: this.samplerecievedt2, todayflag: todayflag, Stasusflag: this.SmpSearchFilter.Stasusflag };
      localStorage.setItem("ReportSmpFilter", JSON.stringify(smpfilter));
    },
    // 申请项目选择结束
    SelectFocus(fieldname) {
      var datatype = "";
      var option = [];
      if (fieldname == "reqitem") datatype = "Multi_reqitem";
      this.multidatatype = datatype;
      this.$refs.MultiSql.loadAllData();
    },
    // #endregion 待检样本

    // #region 图像
    // 捕获按钮
    OpenCatchImage() {
      if (this.UpdateJudge()) {
        return;
      }
      if (typeof jsObj != "undefined") {
        //jsObj.AsyncCall("入参");  js这边就这样调用
        var s = jsObj.AsyncCall("callexe:ImageCatch.exe");
      } else {
        this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
          confirmButtonText: "确定",
        });
      }
    },
    // 图像捕获
    imagecatch(imgbase64) {
      console.log("saveimage");
      var imgedata = "data:image/png;base64," + imgbase64;
      // 捕获时如果当前标本号还没有报告ID,新建一个报告ID去保存图片
      if (!this.PatientInfo.reportid) {
        this.PatientInfo.reportid = XE.toDateString(this.selectdate, "yyyyMMdd") + "-" + this.rptunitid + "-" + this.specno;
      }
      this.ImageUpload(imgedata);
    },
    // 导出
    ExportImage(name) {
      var ftype = "image/JPG";
      // console.log('ftype',ftype);
      if (!name) name = "图片导出";
      if (this.selectimage != "") {
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            data: {
              action: "queryclearimage",
              reportid: this.PatientInfo.reportid,
              graphitemno: this.selectname,
              seq: this.selectseq,
            },
          })
          .then((res) => {
            if (!res.hasOwnProperty("errcode")) {
              let clearimage = res;
              var basestring = "";
              if (clearimage.split(",")[0].indexOf("base64") >= 0) {
                basestring = atob(clearimage.split(",")[1]);
              } else {
                basestring = unescape(clearimage.split(",")[1]);
              }
              var mimestring = clearimage.split(",")[0].split(":")[1].split(";")[0];
              var ia = new Uint8Array(basestring.length);
              for (let i = 0; i < basestring.length; i++) {
                ia[i] = basestring.charCodeAt(i);
              }
              let blob = new Blob([ia], {
                type: mimestring,
              });
              let reader = new FileReader();
              reader.readAsDataURL(blob);
              reader.onload = (e) => {
                let objectUrl = window.URL.createObjectURL(blob);
                let a = document.createElement("a");
                a.download = name + ".jpg";
                a.href = objectUrl;
                //console.log("a.href", a.href);
                a.click();
                a.remove();
                // console.log("a", a)
                window.URL.revokeObjectURL(objectUrl);
              };
            }
          })
          .catch((error) => {
            this.$message.error("错误:" + error);
          });
      } else {
        this.$alert("未选中图片", "提示");
      }
    },
    // 点击获取清晰度更高的图片
    ShowClearImage(name, seq) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryclearimage",
            reportid: this.PatientInfo.reportid,
            graphitemno: name,
            seq: seq,
          },
        })
        .then((res) => {
          if (!res.hasOwnProperty("errcode")) {
            this.selectclearimage = res;
          }
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    // 检索图像
    QueryImage(index) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryimage",
            reportid: this.PatientInfo.reportid,
            w: this.Options.thumbnailwidth,
            h: this.Options.thumbnailheight,
          },
        })
        .then((res) => {
          if (!res.hasOwnProperty("errcode")) {
            this.DealImageData(res, index);
          }
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    // 图像赋值
    DealImageData(res, index) {
      var ImageList = res;
      this.ImageList = [];
      this.ImageIndex = [];
      this.ImageDiff = false;
      if (ImageList.length > 0) {
        for (let i = 0; i < ImageList.length; i++) {
          this.ImageList.push({ name: ImageList[i].Item3, url: ImageList[i].Item1, comm: ImageList[i].Item2, seq: ImageList[i].Item4 });
          this.ImageIndex.push(false);
        }
        if (index) {
          this.selectimage = XE.clone(this.ImageList[index - 1].url, true);
          this.selectseq = XE.clone(this.ImageList[index - 1].seq, true);
          this.selectname = XE.clone(this.ImageList[index - 1].name, true);
          this.imagecomm = this.ImageList[index - 1].comm;
          this.ImageIndex[index - 1] = true;
        } else {
          this.selectimage = XE.clone(this.ImageList[0].url, true);
          this.selectseq = XE.clone(this.ImageList[0].seq, true);
          this.selectname = XE.clone(this.ImageList[0].name, true);
          this.imagecomm = this.ImageList[0].comm;
          this.ImageIndex[0] = true;
        }
      } else {
        this.ImageList = [];
        this.ImageIndex = [];
        this.ImageDiff = false;
        this.selectimage = "";
        this.selectname = "";
        this.selectseq = "";
        this.imagecomm = "";
      }
    },
    // 选择图像
    ImageCommSelect() {
      this.popdatatype = "LIS3_imagecomm";
      this.QueryAdvice("G");
      this.dialogAdviceVisible = true;
      this.advicetype = "2";
      this.advicetxt = this.imagecomm.replace(/\\n/g, "\n");
    },
    // 右键点击图像
    RightClickImage(e, name) {
      var that = this;
      that.selectimage = e.target.src;
      var ritems = [
        {
          label: "导出",
          onClick: () => {
            that.ExportImage(name);
          },
        },
      ];
      this.$contextmenu({
        items: ritems,
        x: e.clientX,
        y: e.clientY,
        customClass: "RightBack",
        zIndex: 2999,
        minWidth: 230,
      });
    },
    // 图片更换
    imagechange(img, index) {
      this.selectimage = "";
      this.selectimage = img.url;
      this.imagecomm = img.comm;
      this.selectname = img.name;
      this.selectseq = img.seq;
      for (let i = 0; i < this.ImageIndex.length; i++) {
        this.ImageIndex[i] = false;
      }
      this.ImageIndex[index] = true;
    },
    // 上传图片
    uploadimage(simg) {
      var file = simg.file;
      var name = file.name; //选中文件的文件名
      var size = file.size; //选中文件的大小

      var reader = new FileReader();
      var AllowImgFileSize = 10485760; //上传图片最大值(单位字节)（ 10 M = 10485760 B ）超过2M上传失败
      var imgUrlBase64;
      var _this = this;
      if (file) {
        //将文件以Data URL形式读入页面
        imgUrlBase64 = reader.readAsDataURL(file);

        reader.onload = function (e) {
          //var ImgFileSize = reader.result.substring(reader.result.indexOf(",") + 1).length;//截取base64码部分（可选可不选，需要与后台沟通）
          if (AllowImgFileSize != 0 && AllowImgFileSize < reader.result.length) {
            _this.$alert("只能上传不超过10M的图片", "错误", {
              confirmButtonText: "确定",
            });
            return;
          } else {
            //执行上传操作
            _this.ImageUpload(reader.result);
          }
        };
      }
    },
    // 执行上传
    ImageUpload(imagedata) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "saveimage",
            imagedata: imagedata,
            reportid: this.PatientInfo.reportid,
          },
        })
        .then((res) => {
          if (res != "") {
            this.$alert(res);
          } else {
            this.SaveReportandResult(0, this.selectdate, this.rptunitid)
              .then(() => {
                this.QueryImage(this.ImageIndex.length + 1);
              })
              .catch(() => {
                this.QueryImage(this.ImageIndex.length + 1);
              });
          }
        });
    },
    // 删除
    DelImage(seq, itemno) {
      if (!this.PatientInfo.reportid) {
        this.$alert("请先保存报告数据，再选择图片！");
        return;
      }
      if (this.UpdateJudge()) {
        return;
      }
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "delimage",
            reportid: this.PatientInfo.reportid,
            seq: seq ? seq : this.selectseq,
            graphitemno: itemno ? itemno : this.ImageList.filter((item) => item.seq == this.selectseq)[0].name,
          },
        })
        .then((res) => {
          if (res != "") {
            this.$alert(res);
          } else {
            this.ImageList = this.ImageList.filter((item) => item.seq != (seq ? seq : this.selectseq));
            this.SaveReportandResult(0, this.selectdate, this.rptunitid)
              .then(() => {
                this.QueryImage(this.ImageIndex.length - 1);
              })
              .catch(() => {
                this.QueryImage(this.ImageIndex.length - 1);
              });
          }
        });
    },
    // 切换图片
    Changeimageseq(type) {
      if (!this.PatientInfo.reportid) {
        this.$alert("请先保存报告数据，再选择图片！");
        return;
      }
      if (this.UpdateJudge()) {
        return;
      }
      var seq = this.selectseq;
      var graphitemno = "";
      var item = this.ImageList.find((item) => item.seq == this.selectseq);
      if (item) graphitemno = item.name;
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "changeimageseq",
            reportid: this.PatientInfo.reportid,
            seq: seq,
            graphitemno: graphitemno,
            seqtype: type,
          },
        })
        .then((res) => {
          if (res.hasOwnProperty("flag") && res.flag == "1") {
            var index = this.ImageList.findIndex((item) => item.seq == res.afterseq) + 1;
            this.SaveReportandResult(0, this.selectdate, this.rptunitid)
              .then(() => {
                this.QueryImage(index);
              })
              .catch(() => {
                this.QueryImage(index);
              });
          }
        });
    },
    // 选择文字描述
    imagecomminput(val) {
      if (this.selectseq) {
        this.ImageList.filter((item) => item.seq == this.selectseq)[0].comm = val;
        this.ImageDiff = true;
      }
    },
    // #endregion 图像

    // #region 历史结果
    // 单元格样式
    ColumnClassNameHistory({ seq, row, rowIndex, $rowIndex, column }) {
      if (!(column.property < 8)) {
        if (row[column.property + "flag"] == "H") {
          return "warn-high";
        }
        if (row[column.property + "flag"] == "L") {
          return "warn-low";
        }
      }
    },
    // 结果样式
    ResultClass(row, column) {
      if (row.hasOwnProperty(column + "flag")) {
        var stylestr = "padding:0 3px;height:18px;";
        var resultcolor = "";
        var flag = row[column + "flag"];
        switch (flag) {
          case "M":
            resultcolor = this.Options.resultcolor_m;
            break;
          case "H":
            resultcolor = this.Options.resultcolor_h;
            break;
          case "L":
            resultcolor = this.Options.resultcolor_l;
            break;
          case "P":
            resultcolor = this.Options.resultcolor_p;
            break;
          case "W":
            resultcolor = this.Options.resultcolor_w;
            break;
          case "E":
            resultcolor = this.Options.resultcolor_e;
            break;
          case "Q":
            resultcolor = this.Options.resultcolor_w;
            break;
          default:
            resultcolor = "";
            break;
        }

        if (this.Options.resultcolor_mode == "1") {
          //颜色模式为改变字体颜色时，如果是正常结果，也变灰
          if ((resultcolor == "" || resultcolor == this.Options.resultcolor_m) && ("," + this.historyuncheckrpts + ",").indexOf("," + column + ",") > -1) {
            stylestr += "color:#746565;";
          } else if (resultcolor != "") {
            stylestr += "color:" + resultcolor + ";";
          }
        }
        else {
          if (resultcolor != "") stylestr += "background-color:" + resultcolor + ";";
          if (("," + this.historyuncheckrpts + ",").indexOf("," + column + ",") > -1) {
            stylestr += "color:#746565;";
          }
        }

        if (row.rptitem == "采样时间") {
          //如果是同一天，那么把背景色改成浅绿色
          if (this.$tool.compareSameDate(new Date(this.PatientInfo.sampled_dt), new Date(row[column]))) {
            stylestr += "background-color:#80ff80;";
          }
        }

        if (row.rptitem == "条码号") {
          //如果是退回标本，那么把背景色改成黄色
          if (row[column].indexOf("-退") > -1) {
            stylestr += "background-color:yellow;";
          }
        }
        return stylestr;
      }
      return "";
    },
    // 选中当前行
    CurrentHistoryChange({ row }) {
      if (this.GermHistoryflag) {
        this.QueryHistorMed(row.reportid, row.rpt_itemcode);
      } else if (this.$refs.xTableDialogHistory) {
        if (row.rptitem != "报告单元" && row.rptitem != "标本类型") {
          this.DrawCharts("dialoghistoryChart", row);
        }
      } else {
        if (row.rptitem != "报告单元" && row.rptitem != "标本号" && row.rptitem != "病人号" && row.rptitem != "性别 年龄" && row.rptitem != "标本类型" && row.rptitem != "姓名") this.DrawCharts("historyChart", row);
      }
    },
    // 双击表头打印
    HistoryTitleDblEvent({ column }) {
      const loading = this.$loading({
        lock: true,
        text: "打印中",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      this.$pub
        .printreport(this, column.property, "2", "", "1", "1")
        .then(() => {
          loading.close();
        })
        .catch(() => {
          loading.close();
        });
    },
    // 双击跳转到该日报告
    async HistoryDblEvent({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, cell }, e) {
      console.log('eee', e);
      console.log('ddd', { row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, cell });
      if (row.rptitemcode == "sampleno" && column.property != "rptitem") {// 点击的是标本号行，并且不是第一列
        let reportid = column.property;
        let rptinfo = await this.$tool.request({ url: "LIS/LIS3/LIS310", method: "post", data: { action: "queryreportinfo", reportid: reportid } });
        console.log('rptinfo', rptinfo);
        if (rptinfo && rptinfo.reportid) {
          await this.$confirm("提示", {
            title: "提示", message: "确定要跳转到：" + rptinfo.rptunitname + "   日期：" + rptinfo.strsampledate + "  标本号：" + rptinfo.sampleno + " 吗？",
            confirmButtonText: "确定", cancelButtonText: "取消",
            focusCancelButton: true,
            type: "warning",
          });
          let change = false;
          if (this.selectdate != rptinfo.sampledate || this.rptunitid != rptinfo.rptunitid) {
            change = true;
          }
          await this.SaveReportandResult(0, this.selectdate, this.rptunitid);
          this.specno = rptinfo.sampleno;
          this.selectdate = rptinfo.sampledate;
          if (this.rptunitid != rptinfo.rptunitid) {
            this.$refs.xTableList.refreshColumn();
            await this.GetOptions(rptinfo.rptunitid);
            await this.QueryCol(rptinfo.rptunitid);
            this.oldrptunitid = rptinfo.rptunitid;
            this.rptunitid = rptinfo.rptunitid;
          }
          if (change) {//日期或者报告单元改变的情况下，列表干脆清空吧
            this.tableDataListS = [];
            this.tableDataList = [];
          }

          let res = await this.$refs.rmlabresult.QueryResult(rptinfo);
          if (!res.hasOwnProperty("res")) {
            res.res = res;
            res.redo = "";
            res.history = 0;
          }
          this.Patredoflag = !!res.redo;
          this.PatHistoryNum = res.history;
          if (this.PRGNO == "LIS311") {
            if (res.iscontainBacteria) {
              this.showPatHistoryNum = res.history;
            } else {
              this.showPatHistoryNum = 0;
            }
          } else {
            this.showPatHistoryNum = res.history;
          }
          var rowdata = XE.clone(res.res, true);
          this.PatientInfo = this.PatientInfoGetname(rowdata);
          this.OldPatientInfo = this.PatientInfoGetname(rowdata);
          this.oldbarcode = rowdata.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
          this.AfterQResult(rowdata.reportid, this);
          // var listrow = this.$refs.xTableList.tableFullData.filter((item) => item.reportid == rowdata.reportid)[0];
          // this.$refs.xTableList.setCurrentRow(listrow).then(() => {
          //     this.$refs.xTableList.scrollToRow(listrow);
          // });

          this.ChangeAsTab();
          this.AfterRefreshSetActive();
        }
      }
    },
    // 细菌报告双击复制结果到当前报告
    GermHistoryDblEvent({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, cell }, e) {
      if (this.PRGNO == "LIS311" && this.PatientInfo && this.PatientInfo.rechkflag == "0") {
        this.$confirm("是否要将本条结果复制到当前报告?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          focusCancelButton: false,
          closeOnClickModal: false,
          type: "warning",
        }).then(() => {
          var resultRow = this.$refs.rmlabresult.$refs.xTableResult.tableFullData.find((item) => item.rpt_itemcode == row.rpt_itemcode);
          if (resultRow) {
            let currowselect = false;
            //当前显示的正好是要复制的报告项目
            if (this.$refs.rmlabresult.tempRptItem && this.$refs.rmlabresult.tempRptItem.rpt_itemcode == row.rpt_itemcode) {
              currowselect = true;
            }
            for (let i = 0; i < this.tableDataHistoryMed.length; i++) {
              var insertrow = this.tableDataHistoryMed[i];
              let rowindex = this.$refs.rmlabresult.MedTotalData.findIndex((item) => item.rpt_itemcode == insertrow.rpt_itemcode && item.medcode == insertrow.medcode);
              // console.log("rowindex", rowindex);
              if (rowindex > -1) {
                // this.$refs.rmlabresult.$refs.xTableMed.insertAt(insertrow, -1);
                // this.$refs.rmlabresult.MedTotalData[rowindex] = XE.clone(insertrow);
                // this.$refs.xTableMed.getTableData().fullData;
              } else {
                insertrow.reportid = this.PatientInfo.reportid;
                insertrow.rpt_itemcode = resultRow.rpt_itemcode;
                this.$refs.rmlabresult.MedTotalData.push(XE.clone(insertrow));
              }
              if (currowselect) {
                var nowrow = this.$refs.rmlabresult.$refs.xTableMed.tableFullData.find((item) => item.medcode == insertrow.medcode);
                if (!nowrow) {
                  insertrow.reportid = this.PatientInfo.reportid;
                  insertrow.rpt_itemcode = resultRow.rpt_itemcode;
                  this.$refs.rmlabresult.$refs.xTableMed.insertAt(insertrow, -1);
                  // this.$refs.rmlabresult.MedTotalData.push(insertrow);
                }
              }
            }
            this.$refs.rmlabresult.ResultAddAsync(resultRow);
          } else {
            var newrow = { rptunitid: this.PatientInfo.rptunitid, reportid: this.PatientInfo.reportid, result_str: "" };
            // newrow.result_num = row.result_num;
            newrow.result_str = row.result_str;
            newrow.result_txt = row.result_txt;
            newrow.result1 = row.result1;
            newrow.result2 = row.result2;
            newrow.result3 = row.result3;
            newrow.result4 = row.result4;
            newrow.reportid = this.PatientInfo.reportid;
            newrow.rpt_itemcode = row.rpt_itemcode;
            newrow.rpt_itemname = row.rpt_itemname;
            for (let i = 0; i < this.tableDataHistoryMed.length; i++) {
              var insertrow = this.tableDataHistoryMed[i];
              insertrow.reportid = this.PatientInfo.reportid;
              insertrow.rpt_itemcode = row.rpt_itemcode;
              this.$refs.rmlabresult.MedTotalData.push(XE.clone(insertrow));
            }
            this.$refs.rmlabresult.ResultAddAsync(newrow);
          }
        });
      }
    },
    // 细菌标志查询条件改变
    germflagChange() {
      this.$tool.setSession("searchgermflag", this.searchgermflag);
      console.log(this.tableDataHistoryTotal);
      if (this.searchgermflag.length > 0) {
        this.tableDataHistory = this.tableDataHistoryTotal.filter((item) => this.searchgermflag.indexOf(item.filtergermflag) > -1);
      } else {
        this.tableDataHistory = JSON.parse(JSON.stringify(this.tableDataHistoryTotal));
      }

    },
    //查找历史结果
    QueryHistory() {
      // 这里是刚切换到历史结果tab页时要清下历史遗留
      if (this.Options.switchreportreload == "1") {
        if (this.HistoryLeftList.length > 0) {
          let curreport = this.HistoryLeftList.find(item => item.Item1 == "本次报告");
          //如果历史结果tab显示的报告ID跟当前报告ID不一样，清空一下
          if (curreport && curreport.Item2.indexOf(this.PatientInfo.reportid) < 0) {
            this.HistoryLeftList = [];
            this.HistoryLeftAllList = [];
            this.tableDataHistory = [];
            this.tableDataHistoryMed = [];
          }
        }
      }
      this.selrptunitlist = "";
      let searchgermflag = this.$tool.getSession("searchgermflag");
      if (searchgermflag) this.searchgermflag = searchgermflag;
      this.loadingHistory = true;
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryhistory",
            reportid: this.PatientInfo.reportid,
            prgno: this.PRGNO,
          },
        })
        .then((res) => {
          if (!res.hasOwnProperty("errcode") && res != "[]" && res != "") {
            // 这里主要针对切换速度较快，前一个还没刷出来，就点了下一个
            if (this.Options.switchreportreload == "1") {
              if (res.length > 0) {
                let curreport = res.find(item => item.Item1 == "本次报告");
                //切换报告速度较快时，返回的历史结果报告ID和当前报告ID不一致时，不再赋值，全部清空
                if (curreport && curreport.Item2.indexOf(this.PatientInfo.reportid) < 0) {
                  this.HistoryLeftList = [];
                  this.HistoryLeftAllList = [];
                  this.tableDataHistory = [];
                  this.tableDataHistoryMed = [];
                  this.loadingHistory = false;
                  return;
                }
              }
            }
            //历史结果分类按检验组分组显示
            if (this.Options.historyresultshowbygroup == "1") {
              this.HistoryLeftAllList = res;
              //先初始化分类
              this.initHistoryClass();
            } else {
              this.HistoryLeftList = res;
              this.HistoryLeftAllList = res;
              // 默认是本次报告
              let currentclass = this.HistoryLeftList[0];
              // 如果已经选择了历史结果分类，那么切换后也要保留选择，切换后报告没有时再选择我的报告
              if (this.historySelectClass && this.historySelectClass != "本次报告") {
                this.HistoryLeftList.forEach((item) => {
                  let itemclass = item.Item1.split("  ")[0];
                  if (itemclass == this.historySelectClass) {
                    currentclass = item;
                  }
                });
              }
              this.$refs.xTableHistoryTab.setCurrentRow(currentclass);
              this.QueryHistoryResult(currentclass.Item1, currentclass.Item2);
            }
          } else {
            this.HistoryLeftList = [];
            this.HistoryLeftAllList = [];
            this.QueryHistoryResult();
          }
          this.loadingHistory = false;
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    // 查询历史记录结果
    QueryHistoryResult(classname, ids) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryhistoryresult",
            reportid: this.PatientInfo.reportid,
            reportclass: classname,
            reportids: ids,
          },
        })
        .then((res) => {
          //切换报告速度较快时，返回的历史结果报告ID和当前报告ID不一致时，不再赋值，全部清空
          if (!res.hasOwnProperty("errcode") && res.reportid == this.PatientInfo.reportid) {
            if (classname.indexOf("细菌") == -1) {
              this.historyuncheckrpts = res.unCheckReportids;
              this.GermHistoryflag = false;
              this.tableColumnHistoryTotal = res.RData.Cols;

              // this.tableColumnHistoryTotal = [];
              // this.tableColumnHistoryDialog = [];
              // this.tableColumnHistoryTotal.push({ field: "rptitem", title: "项目", width: 80 });
              // this.tableColumnHistoryDialog.push({ field: "rptitem", title: "样本日期", width: 100 });
              // if (res.Data.length > 0) {
              //     for (var item in res.Data[0]) {
              //         if (item.indexOf("flag") < 0 && item.indexOf("rptitem") < 0) {
              //             var titlestr = item;
              //             if (item.indexOf("本次") > -1) titlestr = "本次";
              //             else titlestr = item.split("-")[0];
              //             this.tableColumnHistoryTotal.push({ field: item, title: titlestr, width: 80 });
              //             this.tableColumnHistoryDialog.push({ field: item, title: item.split("-")[0], width: 100 });
              //         }
              //     }
              let showcollen = 8;
              //历史结果增加显示均值列
              if (this.Options.historyaddaveragecol == "1") {
                showcollen = 9;
                this.tableColumnHistoryDialog = res.RData.Cols.filter((item) => item.field != "average");
              } else {
                this.tableColumnHistoryDialog = res.RData.Cols;
              }
              if (this.tableColumnHistoryTotal.length > showcollen) {
                this.tableColumnHistory = this.tableColumnHistoryTotal.slice(0, showcollen);
              } else {
                this.tableColumnHistory = JSON.parse(JSON.stringify(this.tableColumnHistoryTotal));
                for (let i = 0; i < showcollen - this.tableColumnHistoryTotal.length; i++) {
                  this.tableColumnHistory.push({ field: i + "", title: "", width: 80 });
                }
              }

              this.tableDataHistoryTotal = res.RData.Data;
              this.tableDataHistoryDialog = this.tableDataHistoryTotal.filter((item) => item.rptitem != "病人号" && item.rptitem != "性别 年龄" && item.rptitem != "标本号" && item.rptitem != "姓名");
              if (this.ShowButtonHistory == "隐藏") {
                this.tableDataHistory = JSON.parse(JSON.stringify(this.tableDataHistoryTotal));
              } else {
                this.tableDataHistory = this.tableDataHistoryTotal.filter((item) => item.rptitem != "病人号" && item.rptitem != "性别 年龄" && item.rptitem != "标本类型" && item.rptitem != "姓名");
              }
            } else {
              this.GermHistoryflag = true;
              this.tableDataHistoryTotal = res.RData.Data;
              this.tableDataHistory = JSON.parse(JSON.stringify(this.tableDataHistoryTotal));
            }

            //}
          } else {
            this.GermHistoryflag = false;
            this.tableColumnHistoryTotal = [];
            this.tableColumnHistoryDialog = [];
            this.tableColumnHistory = [];
            this.tableDataHistory = [];
            this.tableDataHistoryTotal = [];
          }
          this.loadingHistory = false;
          this.DrawCharts("historyChart");
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    // 添加细菌历史结果查询
    QueryHistorMed(reportid, rptitemcode) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS311",
          method: "post",
          data: {
            action: "queryresultmed",
            reportid: reportid,
            rpt_itemcode: rptitemcode,
          },
        })
        .then((res) => {
          if (!res.hasOwnProperty("errcode")) {
            this.tableDataHistoryMed = res.Data;
          }
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    // 初始化历史分单类别分类
    initHistoryClass() {
      //先初始化分类
      this.HistoryLeftList = this.HistoryLeftAllList.filter((item) => item.Item1 == "本次报告" || item.Item1.indexOf("关联项目") > -1 || item.Item2.indexOf("-") == -1);
      //只获取检验组
      let grouplist = this.HistoryLeftAllList.filter((item) => item.Item2.indexOf("-") == -1);
      for (var i = 0; i < grouplist.length; i++) {
        //只有第一个检验组展开，其他全部关闭
        if (i == 0) {
          grouplist[i].Item3 = "-";//展开状态
        } else {
          grouplist[i].Item3 = "+";//关闭状态
        }
        this.HistoryClassChange(grouplist[i]);
      }
      //如果本次报告在第一个，就默认显示本次报告，如果不在第一个，那么就显示第一个检验组的第一个
      if (this.HistoryLeftList[0].Item1 == "本次报告") {
        this.$refs.xTableHistoryTab.setCurrentRow(this.HistoryLeftList[0]);
        this.QueryHistoryResult(this.HistoryLeftList[0].Item1, this.HistoryLeftList[0].Item2);
      } else {
        this.$refs.xTableHistoryTab.setCurrentRow(this.HistoryLeftList[1]);
        this.QueryHistoryResult(this.HistoryLeftList[1].Item1, this.HistoryLeftList[1].Item2);
      }
    },
    // 选择单元分类
    currentHistoryChangeEvent({ row, rowIndex }) {
      this.historySelectClass = row.Item1.split("  ")[0];
      //报告单元分类
      if (row.Item2.indexOf("-") > -1) {
        this.QueryHistoryResult(row.Item1, row.Item2);
      } else {//检验组分类
        if (row.Item3 == "-") {
          row.Item3 = "+";
        } else {
          row.Item3 = "-";
        }
        this.HistoryClassChange(row);
        let rowindex = this.HistoryLeftList.findIndex(item => item.Item1 == row.Item1);
        if (row.Item3 == "-") {
          this.$refs.xTableHistoryTab.setCurrentRow(this.HistoryLeftList[rowindex + 1]);
          this.QueryHistoryResult(this.HistoryLeftList[rowindex + 1].Item1, this.HistoryLeftList[rowindex + 1].Item2);
        } else {
          //关闭的时候把当前行变一下
          this.$refs.xTableHistoryTab.setCurrentRow(null);
        }
      }
    },
    // 单元分类触发变化
    HistoryClassChange(row) {
      let rptunits = row.Item2.split(",");
      //Item2是由同一报告单元的不同报告ID组成的字符，我们只要取第一个报告ID中间的报告单元ID就行
      let list = this.HistoryLeftAllList.filter((item) => item.Item2.indexOf("-") > -1 && rptunits.indexOf(item.Item2.split("-")[1]) > -1 && item.Item1 != "本次报告" && item.Item1.indexOf("关联项目") == -1);
      if (list && list.length > 0) {
        let rowindex = this.HistoryLeftList.findIndex(item => item.Item1 == row.Item1);
        //先找一下有没有
        let curlist = this.HistoryLeftList.filter((item) => item.Item2.indexOf("-") > -1 && rptunits.indexOf(item.Item2.split("-")[1]) > -1 && item.Item1 != "本次报告" && item.Item1.indexOf("关联项目") == -1);
        //处于展开状态的要把明细全部都添加进去
        if (row.Item3 == "-") {
          //如果已经有，就不往里面插入了,没有的更新一下
          if (curlist && curlist.length > 0) {
            if (curlist.length != list.length) {//如果个数不一样，要更新下
              //先删除旧的，再加新的
              this.HistoryLeftList.splice(rowindex + 1, curlist.length);
              for (let i = 0; i < list.length; i++) {
                this.HistoryLeftList.splice(rowindex + i + 1, 0, list[i]);
              }
            }
          } else {
            for (let i = 0; i < list.length; i++) {
              this.HistoryLeftList.splice(rowindex + i + 1, 0, list[i]);
            }
          }
        } else {//处于关闭状态的要把明细全部删除
          if (curlist && curlist.length > 0) {
            this.HistoryLeftList.splice(rowindex + 1, curlist.length);
          }
        }
      }
    },
    // 单元格样式
    HistoryResultClassName({ seq, row, rowIndex, $rowIndex, column }) {
      if (row.Item2.indexOf("-") > -1) {
        return "";
      } else {
        return "labgroup-style";
      }
    },
    //历史结果关联项目右键菜单
    LinkItemRightClick(e) {
      if (this.historySelectClass != "关联项目") return;
      this.linkItemResultExportVisible = true;
    },
    LinkItemReturn() {
      this.linkItemResultExportVisible = false;
    },
    // 点击隐藏显示病人信息
    ShowInfoHistory() {
      if (this.ShowButtonHistory == "显示") {
        this.ShowButtonHistory = "隐藏";
        this.tableDataHistory = JSON.parse(JSON.stringify(this.tableDataHistoryTotal));
      } else {
        this.ShowButtonHistory = "显示";
        this.tableDataHistory = this.tableDataHistoryTotal.filter((item) => item.rptitem != "病人号" && item.rptitem != "性别 年龄" && item.rptitem != "标本类型" && item.rptitem != "姓名");
      }
    },
    // 画历史结果曲线图
    DrawCharts(chartname, row) {
      var xline = [];
      var xlinefield = [];
      var data = [];
      var column = [];
      if (row) {
        if (this.$refs.xTableDialogHistory) {
          column = this.tableColumnHistoryDialog;
        } else {
          column = this.tableColumnHistory;
        }
        for (let i = 0; i < column.length; i++) {
          if (column[i].title != "项目") {
            if (row[column[i].field]) {
              xline.push(column[i].title);
              xlinefield.push(column[i].field);
            }
          }
        }
        for (let j = 0; j < xlinefield.length; j++) {
          if (row[xlinefield[j]]) {
            data.push(row[xlinefield[j]]);
          }
        }
      }
      //console.log("x",xline,data);
      //echarts画图
      this.charts = echarts.init(document.getElementById(chartname));
      this.charts.setOption({
        title: {
          text: row ? row.rptitem : "结果波动图",
          textAlign: "center",
          x: "center",
          y: "top",
        },
        tooltip: {
          trigger: "axis",
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: {
          name: "",
          nameLocation: "middle",
          type: "category",
          boundaryGap: false,
          data: xline,
          axisLabel: {
            fontSize: 8,
          },
        },
        yAxis: {
          name: "",
          nameLocation: "middle",
          boundaryGap: false,
          type: "value",
          axisLabel: {
            fontSize: 8,
          },
        },
        series: [
          {
            name: row ? row.rptitem : "结果",
            type: "line",
            stack: "总量",
            data: data,
          },
        ],
      });
    },
    // 根据报告单元找单元分类
    rptunitchange(val) {
      this.selrptunitlist = val;
      this.EnterRptunitChange();
    },
    // 回车触发
    EnterRptunitChange() {
      if (this.selrptunitlist == "") {
        if (this.Options.historyresultshowbygroup == "1") {
          this.initHistoryClass();
        } else {
          this.HistoryLeftList = this.HistoryLeftAllList;
          if (this.HistoryLeftList && this.HistoryLeftList.length > 0) {
            //选中第一个，然后去找历史信息结果
            this.$refs.xTableHistoryTab.setCurrentRow(this.HistoryLeftList[0]);
            this.QueryHistoryResult(this.HistoryLeftList[0].Item1, this.HistoryLeftList[0].Item2);
          } else {
            this.QueryHistoryResult();
          }
        }
        return;
      }
      //根据选中的报告单元筛选历史结果的分类
      if (this.HistoryLeftAllList.length > 0) {
        let rptunits = this.selrptunitlist.split(",");
        let newLeftList = [];
        //Item2是由同一报告单元的不同报告ID组成的字符，我们只要取第一个报告ID中间的报告单元ID就行
        this.HistoryLeftList = this.HistoryLeftAllList.filter((item) => rptunits.indexOf(item.Item2.split("-")[1]) > -1);
        if (this.HistoryLeftList && this.HistoryLeftList.length > 0) {
          //选中第一个，然后去找历史信息结果
          this.$refs.xTableHistoryTab.setCurrentRow(this.HistoryLeftList[0]);
          this.QueryHistoryResult(this.HistoryLeftList[0].Item1, this.HistoryLeftList[0].Item2);
        } else {
          this.QueryHistoryResult();
        }
      }
    },
    // #endregion 历史结果

    // #region 混样明细
    cellMixTabClassName({ column, row, columnIndex }) {
      if (column.property == "req_statname") {
        return this.$pub.getreqstatclass(row.req_stat);
      } else {
        return "";
      }
    },
    // 查询混样明细
    QuerymixDetail() {
      this.loadingMixTab = true;
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "getreqmixdetail",
            reportid: this.PatientInfo.reportid,
          },
        })
        .then((res) => {
          if (res.errcode == "1") {
            this.tableDataMixTab = res.data;
          } else {
            this.tableDataMixTab = [];
          }
          this.loadingMixTab = false;
        })
        .catch((err) => {
          this.loadingMixTab = false;
        });
    },
    // #endregion 混样明细

    // #region 样本图像
    QuerySampleImage() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "querybarcodeimage",
            barcode: this.PatientInfo.barcode,
          },
        })
        .then((res) => {
          if (!res.hasOwnProperty("errcode")) {
            this.DealSampleImageData(res);
          }
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    sampleimagechange(img, index) {
      this.selectsampleimage = img;
      for (let i = 0; i < this.SampleImageIndex.length; i++) {
        this.SampleImageIndex[i] = false;
      }
      this.SampleImageIndex[index] = true;
    },
    // 样本图像赋值
    DealSampleImageData(res) {
      this.sampleImageList = res;
      this.SampleImageIndex = [];
      if (this.sampleImageList.length > 0) {
        for (let i = 0; i < this.sampleImageList.length; i++) {
          this.SampleImageIndex.push(false);
        }
        this.selectsampleimage = XE.clone(this.sampleImageList[0], true);
        this.SampleImageIndex[0] = true;
      } else {
        this.sampleImageList = [];
        this.SampleImageIndex = [];
        this.selectsampleimage = "";
      }
    },
    // #endregion 样本图像

    // #region 输入模板
    //查询输入模板
    QueryInputMdl() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryinputmdl",
            rptunitid: this.rptunitid,
          },
        })
        .then((res) => {
          this.DealInputMdl(res);
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    // 输入模板赋值
    DealInputMdl(res) {
      this.tableDataInputMdl = res.Data;
      this.tableColumnInputMdl = res.Cols;
    },
    // 获取批输入模板对应的报告项目
    QueryMdlItem(row) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryinputmdlitem",
            sex: this.PatientInfo.pat_sex,
            ageyear: this.PatientInfo.pat_birth ? this.PatientInfo.pat_birth : this.PatientInfo.pat_agestr,
            specimen: this.PatientInfo.specimen_code,
            physicycle: this.PatientInfo.physicycle,
            deptno: this.PatientInfo.req_deptno,
            diagicd: this.PatientInfo.pat_diag_icd,
            hospcode: this.PatientInfo.hospcode, //危急值设置增加了送检医院相关
            reportid: this.PatientInfo.reportid,
            patinfo: this.PatientInfo,
            rptunitid: this.rptunitid,
            inputmdlid: row.inputmdlid,
          },
        })
        .then((res) => {
          if (!res.hasOwnProperty("errcode")) {
            var hasnum = 0;
            //区分单双列模式
            let resultdata = [];
            if (this.Options.doubleresultcol > 0) {
              //双列
              resultdata = XE.union(this.$refs.rmlabresult.$refs.xTableResult.tableFullData, this.$refs.rmlabresult.$refs.xTableResult1.tableFullData);
            } else {
              //单列
              resultdata = this.$refs.rmlabresult.$refs.xTableResult.tableFullData;
            }
            for (let i = 0; i < res.length; i++) {
              if (resultdata.filter((item) => item.rpt_itemcode == res[i].rpt_itemcode && item.result_str != "未做" && item.result_str != "" && item.result_str != "pending" && item.result_str != "已上机" && item.result_str != "待做").length > 0) {
                hasnum += 1;
              }
            }
            let newrowindex = resultdata.length;
            if (hasnum) {
              this.$confirm("是否要用默认结果取代检验结果", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                focusCancelButton: true,
                closeOnClickModal: false,
                type: "warning",
              })
                .then(() => {
                  for (let i = 0; i < res.length; i++) {
                    if (resultdata.filter((item) => item.rpt_itemcode == res[i].rpt_itemcode).length == 0) {
                      this.DoubleColInsertResult(res[i]);
                    } else {
                      for (var item in res[i]) {
                        if (item != "rpt_itemname") {
                          if (resultdata.filter((item) => item.rpt_itemcode == res[i].rpt_itemcode)[0].hasOwnProperty(item)) {
                            resultdata.filter((item) => item.rpt_itemcode == res[i].rpt_itemcode)[0][item] = res[i][item];
                          }
                        }
                      }
                    }
                    if (this.PRGNO == "LIS311") this.$refs.rmlabresult.QueryMedGroup("", res[i].rpt_itemcode, true, "1");
                  }
                  this.ActiveAtResultStr(newrowindex);
                  this.SetTxtinfoAndLabAdvice(row);
                })
                .catch(() => {
                  for (let i = 0; i < res.length; i++) {
                    if (resultdata.filter((item) => item.rpt_itemcode == res[i].rpt_itemcode).length == 0) {
                      this.DoubleColInsertResult(res[i]);
                    }
                    if (this.PRGNO == "LIS311") this.$refs.rmlabresult.QueryMedGroup("", res[i].rpt_itemcode, true, "1");

                  }
                  this.ActiveAtResultStr(newrowindex);
                  this.SetTxtinfoAndLabAdvice(row);
                });
            } else {
              for (let i = 0; i < res.length; i++) {
                if (resultdata.filter((item) => item.rpt_itemcode == res[i].rpt_itemcode).length == 0) {
                  this.DoubleColInsertResult(res[i]);
                } else {
                  for (var item in res[i]) {
                    if (item != "rpt_itemname") {
                      if (resultdata.filter((item) => item.rpt_itemcode == res[i].rpt_itemcode)[0].hasOwnProperty(item)) {
                        resultdata.filter((item) => item.rpt_itemcode == res[i].rpt_itemcode)[0][item] = res[i][item];
                      }
                    }
                  }
                }
                if (this.PRGNO == "LIS311") this.$refs.rmlabresult.QueryMedGroup("", res[i].rpt_itemcode, true, "1");
              }
              this.ActiveAtResultStr(newrowindex);
              this.SetTxtinfoAndLabAdvice(row);
            }
            //如果当前病人信息中标本类型为空，那么就把当前选择的输入模板的标本类型给带过去
            if (!this.PatientInfo.specimen_code && row.specimen_code) {
              this.PatientInfo.specimen_code = row.specimen_code;
              this.PatientInfo.specimen_codename = row.specimen_name;
            }
          } else {
            this.$alert(res.errmsg, "错误", {
              confirmButtonText: "确定",
            });
          }
        });
    },
    // 单击result添加模板对应报告项目
    MdlClick({ row }) {

      if (this.Options.inputmdlbydoubleclick != "1") {
        if (this.PatientInfo["rechkflag"] == "9" || (this.Options.onlymodifymyreport == "1" && this.$tool.getSession(this.$tool.loginuserno) != this.PatientInfo["report_user"]) || (this.PatientInfo.barcode && this.PatientInfo.barcode.indexOf("-退") > -1)) {
        } else {
          this.QueryMdlItem(row);
        }
      }
    },
    // 双击result添加模板对应报告项目
    MdlDblClick({ row }) {

      if (this.Options.inputmdlbydoubleclick == "1") {
        if (this.PatientInfo["rechkflag"] == "9" || (this.Options.onlymodifymyreport == "1" && this.$tool.getSession(this.$tool.loginuserno) != this.PatientInfo["report_user"]) || (this.PatientInfo.barcode && this.PatientInfo.barcode.indexOf("-退") > -1)) {
        } else {
          this.QueryMdlItem(row);
        }
      }
    },
    // 添加默认文字描述1，默认文字描述2，默认实验意见
    SetTxtinfoAndLabAdvice(row) {
      //基因报告使用模板时把默认文字描述1，默认文字描述2，默认实验意见也给覆盖上去
      if (this.PRGNO == "LIS314") {
        //只要有一个不为空就要提示是否替换
        if (this.$refs.rmlabresult.txtinfo1 != "" || this.$refs.rmlabresult.txtinfo2 != "" || this.$refs.rmlabresult.lab_advice != "" || this.PatientInfo.txtinfo1 != "" || this.PatientInfo.txtinfo2 != "" || this.PatientInfo.lab_advice != "") {
          this.$confirm("是否要用默认文字描述和实验意见取代现有文字描述和实验室意见", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            focusCancelButton: true,
            closeOnClickModal: false,
            type: "warning",
          })
            .then(() => {
              this.$refs.rmlabresult.txtinfo1 = row.txtinfo1;
              this.$refs.rmlabresult.txtinfo2 = row.txtinfo2;
              this.$refs.rmlabresult.lab_advice = row.lab_advice;
              this.PatientInfo.txtinfo1 = row.txtinfo1;
              this.PatientInfo.txtinfo2 = row.txtinfo2;
              this.PatientInfo.lab_advice = row.lab_advice;
            })
            .catch(() => {
              //不替换就啥也不干
            });
        } else {
          this.$refs.rmlabresult.txtinfo1 = row.txtinfo1;
          this.$refs.rmlabresult.txtinfo2 = row.txtinfo2;
          this.$refs.rmlabresult.lab_advice = row.lab_advice;
          this.PatientInfo.txtinfo1 = row.txtinfo1;
          this.PatientInfo.txtinfo2 = row.txtinfo2;
          this.PatientInfo.lab_advice = row.lab_advice;
        }
      } else {
        //要把病人信息中的文字描述1，文字描述2，实验意见给加上
        //只要有一个不为空就要提示是否替换
        if (this.PatientInfo.txtinfo1 != "" || this.PatientInfo.txtinfo2 != "" || this.PatientInfo.lab_advice != "") {
          this.$confirm("是否要用默认文字描述和实验意见取代现有文字描述和实验室意见", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            focusCancelButton: true,
            closeOnClickModal: false,
            type: "warning",
          })
            .then(() => {
              this.PatientInfo.txtinfo1 = row.txtinfo1;
              this.PatientInfo.txtinfo2 = row.txtinfo2;
              this.PatientInfo.lab_advice = row.lab_advice;
            })
            .catch(() => {
              //不替换就啥也不干
            });
        } else {
          this.PatientInfo.txtinfo1 = row.txtinfo1;
          this.PatientInfo.txtinfo2 = row.txtinfo2;
          this.PatientInfo.lab_advice = row.lab_advice;
        }
      }
    },
    //根据当前结果条数和双列最大行数来决定往哪里加
    DoubleColInsertResult(insertresultdata) {
      //只要是双列模式，统统往右侧加，不管双列每列显示行数了
      if (this.Options.doubleresultcol > 0) {
        this.$refs.rmlabresult.$refs.xTableResult1.insertAt(insertresultdata, -1);
      } else {
        this.$refs.rmlabresult.$refs.xTableResult.insertAt(insertresultdata, -1);
      }
    },
    // 模板输入后聚焦在检验结果第一列
    ActiveAtResultStr(rowindex) {
      var row = this.$refs.rmlabresult.$refs.xTableResult.tableFullData[rowindex];
      this.$refs.rmlabresult.$refs.xTableResult.setCurrentRow(row);
      this.$refs.rmlabresult.$refs.xTableResult.setActiveCell(row, "result_str");
    },
    // #endregion 输入模板

    // #region 申请
    //查询申请
    QueryApply() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryreqitem",
            barcode: this.PatientInfo.barcode,
            rptunitid: this.rptunitid,
            sampleno: this.specno,
            reportid: this.PatientInfo.reportid,
          },
        })
        .then((res) => {
          this.$refs.reqitemdialog.DealApplyData(res);
          //this.DealApplyData(res);
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    // 查询申请项目
    QueryApplyItem(itemcode) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryreqitemvsrpt",
            req_itemcode: itemcode,
            rptunitid: this.rptunitid,
          },
        })
        .then((res) => {
          this.tableDataApplyDown = res.rpt.Data;
          this.tableColumnApplyDown = res.rpt.Cols;
          this.tableDataApplyFee = res.feeitem;
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    ApplyDownClass({ row, rowIndex }) {
      if (row.iscurrptunit != "是") {
        return "hasworked";
      }
    },
    // 申请项目变更提交
    ReqChangeSubmit(data) {
      if (data) {
        for (let i = 0; i < data.length; i++) {
          if (this.$refs.rmlabresult.$refs.xTableResult.tableFullData.filter((item) => item.rpt_itemcode == data[i].rpt_itemcode) == 0) {
            this.$refs.rmlabresult.$refs.xTableResult.insertAt(data[i], -1);
          }
          this.$refs.reqitemdialog.dialogreqVisible = false;
        }
      }
    },
    // 通过申请保存病人信息
    SavePatInfoByReq() {
      this.BarcodeRequest()
        .then((res) => {
          this.afterBarcodeInputSuccess(res).then(() => {
            this.changekeyflag = false;
          });
        })
        .catch((e) => {
          this.PatientInfo.barcode = ""; //出错的话，条码号一律清空
          this.oldbarcode = "";
          this.OldPatientInfo.barcode = "";
          this.changekeyflag = false;
        });
    },
    // #endregion 申请

    // #region 通讯
    // 通讯查询
    QueryCommunite() {
      this.loadingCommunite = true;
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "getlabinstrcomlog",
            rptunitid: this.rptunitid,
          },
        })
        .then((res) => {
          this.DealCommuite(res);
          this.loadingCommunite = false;
        });
    },
    // 通讯结果赋值
    DealCommuite(res) {
      this.tableDataCommunite = res.Data;
      this.tableColumnCommunite = res.Cols;
    },
    // #endregion 通讯

    // #region 危急值项目
    //查询危急值项目
    QueryAlteritemData() {
      this.Alteritemloading = true;
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryalteritemdata",
            reportid: this.PatientInfo.reportid,
          },
        })
        .then((res) => {
          this.Alteritemloading = false;
          this.alteritemData = [];
          if (res.flag == "1") {
            if (res.data.length > 0) {
              this.alertiteminfo = res.data;
              this.alertiteminfo.forEach((item) => {
                this.alteritemData.push({ rpt_itemname: item.Item1 });
              });
              this.$refs.xTableAlterTab.setCurrentRow(this.alteritemData[0]);
              this.activities = this.alertiteminfo[0].Item2;
            }
          } else {
            this.$alert(res.msg, "提示");
          }
        });
    },
    // 当前行选择
    alteritemChange({ row }) {
      this.alertiteminfo.filter((item) => {
        if (item.Item1 == row.rpt_itemname) {
          this.activities = item.Item2;
        }
      });
    },
    // #endregion 危急值项目

    // #region 原始结果
    //查询仪器原始结果
    QueryInstrData() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryinstrresult",
            reportid: this.PatientInfo.reportid,
            rptunitid: this.rptunitid,
          },
        })
        .then((res) => {
          if (res && res.hasOwnProperty("flag") && res.flag == "1") {
            this.tableDataInstr = res.dt;
          } else {
            this.tableDataInstr = [];
          }
        })
        .catch((err) => {
          console.log("instrdataerr:" + err);
        });
    },
    // #endregion 原始结果

    // #region 日志
    LoadRptLogDetail(detaildata) {
      this.tableDataRptLogDetail = detaildata;
    },
    // #endregion 日志

    // #endregion 右侧tab页方法库


    // #region 上方头部按钮方法库
    // 上一个下一个先保存
    SpecnoExchange(value, type) {
      this.SaveReportandResult(0, this.selectdate, this.rptunitid).then((r) => {
        //清空一下病人信息和结果，防止有的时候反应慢，切换速度跟不上容易看错
        if (this.Options.switchreportreload == "1") {
          this.InitPatientInfo("changereportinit");
          this.$refs.rmlabresult.tableDataResult = [];
          if (this.Options.doubleresultcol == "1") this.$refs.rmlabresult.tableDataResult1 = [];
          //如果历史结果tab开着，也要清空一下
          if (this.tabvalue == "3") {
            this.HistoryLeftList = [];
            this.HistoryLeftAllList = [];
            this.tableDataHistory = [];
            this.tableDataHistoryMed = [];
          }
        }
        this.SpecChangeAction(value, type);
      });
    },
    // 真正执行上一个下一个
    SpecChangeAction(value, type) {
      this.checkingflag = false;
      if (value > 0) {
        //下一个
        //this.pageinitloading = true;
        this.GetNextSpecno().then((res) => {
          //this.SaveandChangeAction(this.specno);
          //提高性能，没必要多次 filter 去查找标本号
          let findrow = this.$refs.xTableList.afterFullData.find((item) => item.sampleno == this.specno && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid);
          if ((this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) && this.specno.length > this.Options.samplenouniquelen) {
            var daterange = this.JudgeSampleDate(this.Options.samplenouniquelen);
            findrow = this.$refs.xTableList.afterFullData.find((item) => item.sampleno == this.specno && item.sampledate <= daterange.end && item.sampledate >= daterange.start && item.rptunitid == this.rptunitid);
          }
          if (findrow) {
            this.SetInfoByRow(findrow, this.specno).then(() => {
              this.ChangeAsTab();
              this.AfterRefreshSetActive();
            }); //通过找到的行数据，赋值页面显示，多处地方用到，提取公共方法
            this.GetBarcodeHasVal(findrow);
            this.tempRowIndex = this.tempRowIndex + 1; //选中行序号，不一定就是+1 因为列表中不一定就是按照标本号排序的
            //this.pageinitloading = false;
            //开启特殊患者关注项目提醒
            if (this.Options.specialpatconcernitemalert == "1") {
              this.queryConcernItem(findrow.reportid);
            }
            //获取特殊标记
            this.Queryreportmark(findrow);
          } else {
            //新的标本  还有 加载默认值、自动记忆上次值的功能 未完成 TODO
            this.$pub.Log("开始添加新标本");
            this.AddNewReport().then(() => {
              this.$pub.Log("添加新标本结束");
              this.SpecAddflag = 1;
              this.barcodeinputsuccessflag = false;
              this.ChangeAsTab();
              this.AfterRefreshSetActive();
              //this.pageinitloading = false;
            });
          }
        });
      } else {
        //上一个
        //this.pageinitloading = true;
        this.GetLastSpecno().then((res) => {
          //this.SaveandChangeAction(this.specno);
          let findrow = this.$refs.xTableList.tableFullData.find((item) => item.sampleno == this.specno && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid);
          if ((this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) && this.specno.length > this.Options.samplenouniquelen) {
            var daterange = this.JudgeSampleDate(this.Options.samplenouniquelen);
            findrow = this.$refs.xTableList.afterFullData.find((item) => item.sampleno == this.specno && item.sampledate <= daterange.end && item.sampledate >= daterange.start && item.rptunitid == this.rptunitid);
          }
          if (findrow) {
            this.SetInfoByRow(findrow, this.specno).then(() => {
              this.ChangeAsTab();
              this.AfterRefreshSetActive();
            }); //通过找到的行数据，赋值页面显示，多处地方用到，提取公共方法
            this.GetBarcodeHasVal(findrow);
            if (this.tempRowIndex > 0) this.tempRowIndex = this.tempRowIndex - 1; //选中行序号 TODO
            //this.pageinitloading = false;
            //开启特殊患者关注项目提醒
            if (this.Options.specialpatconcernitemalert == "1") {
              this.queryConcernItem(findrow.reportid);
            }
            //获取特殊标记
            this.Queryreportmark(findrow);
          } else {
            this.AddNewReport().then(() => {
              this.SpecAddflag = 1;
              this.barcodeinputsuccessflag = false;
              this.ChangeAsTab();
              this.AfterRefreshSetActive();
              //this.pageinitloading = false;
            });
          }
        });
      }
      if (!this.btndisabled) this.$refs.barcode[0].focus();
    },
    // 获取下一个标本号
    GetNextSpecno() {
      return new Promise((s, f) => {
        if (this.$refs.rmLabReportCollect.dialogCollectVisible) {
          this.specno = this.$pub.GetNextSpecno(this.$refs.rmLabReportCollect.collectsampleno);
        } else {
          this.specno = this.$pub.GetNextSpecno(this.specno);
        }
        this.$refs.rmLabReportCollect.samplenochg(this.specno);
        s();
      });
    },
    // 获取上一个标本号
    GetLastSpecno() {
      return new Promise((s, f) => {
        if (this.$refs.rmLabReportCollect.dialogCollectVisible) {
          this.specno = this.$pub.GetLastSpecno(this.$refs.rmLabReportCollect.collectsampleno);
        } else {
          this.specno = this.$pub.GetLastSpecno(this.specno);
        }
        this.$refs.rmLabReportCollect.samplenochg(this.specno);
        s();
      });
    },
    // 结果新增
    ResultAdd() {
      this.$refs.rmlabresult.ResultAddAsync();
    },
    // 这个方法冗余了，可以直接用结果里面的这个方法
    ResultAddAsync() {
      new Promise((resolve) => {
        this.ResultAdd();
        resolve();
      }).then(() => {
        if (this.PRGNO == "LIS310" && this.$refs.rmlabresult.Options.doubleresultcol == 1) {
          this.$refs.rmlabresult.$refs.xTableResult1.$refs.tableBody.$children[0].focus();
        } else {
          this.$refs.rmlabresult.$refs.xTableResult.$refs.tableBody.$children[0].focus();
        }

      });
    },
    // #endregion 上方头部按钮方法库


    // #region 中间结果区域方法库
    // 双击打印报告
    CenterDblClick(e) {
      if (this.PatientInfo.rechkflag == "9") {
        this.CheckPrint(2);
      }
      //this.ResultAddAsync();
    },
    // 结果改变
    ResultChange(val) {
      if (this.Options.inputasreportuser != "1") {
        this.PatientInfo.report_username = this.exactusernamereport;
        this.PatientInfo.report_user = this.exactusernoreport;
      }
      //目前val就用来记录txtinfo变化,基因用
      if (val) this.PatientInfo.txtinfo1 = val;
      this.changeflag = true;
    },
    // 结果病人信息改变
    ResultPatChange(patinfo, prechkflag, redostr) {
      if (patinfo) {
        var row = this.$refs.xTableList.afterFullData.find((item) => item.sampleno == patinfo.sampleno && item.sampledate == patinfo.sampledate && item.rptunitid == patinfo.rptunitid);
        if (row) {
          var index = this.$refs.xTableList.afterFullData.indexOf(row);
          this.$refs.xTableList.afterFullData[index].alter_flag = patinfo.alter_flag;
          this.$refs.xTableList.afterFullData[index].redo_flag = patinfo.redo_flag;
          this.$refs.xTableList.afterFullData[index].emer_flag = patinfo.emer_flag;
          this.$refs.xTableList.afterFullData[index].rechkflag = patinfo.rechkflag;
          this.$refs.xTableList.afterFullData[index].printflag = patinfo.printflag;
          if (prechkflag) this.$refs.xTableList.afterFullData[index].prechkflag = prechkflag;
          this.NowPatNum = index + 1;
          //设置成当前行，防止后台反应慢，切不到当前显示的报告行
          this.$refs.xTableList.setCurrentRow(row);
        }
        //复查标志更新
        if (redostr == "redo") {
          this.PatientInfo.redo_flag = patinfo.redo_flag;
          this.OldPatientInfo.redo_flag = patinfo.redo_flag;
        }
      }
      this.CalcNum(this.$refs.xTableList.afterFullData);
    },
    // 显示报告pdf
    ShowReportPdf(showflag, url, flag) {
      this.reportpdfelement = "";
      this.reportpdfmsg = "";
      this.reportpdfurl = "";
      this.reportpdfwindowVisible = showflag;
      if (this.reportpdfwindowVisible) {
        if (flag == 0) {
          if (url) {
            this.reportpdfmsg = url;
          }
          else {
            this.reportpdfmsg = "暂无报告pdf信息";
          }
        } else {
          this.reportpdfurl = url;
          this.reportpdfelement = '<embed id="embed-report" width="100%" height="100%" name="plugin" src="' + url + '#toolbar=0" type="application/pdf" >';
        }
        if (localStorage.getItem("floatwindowstyle6")) this.floatwindowstyle6 = localStorage.getItem("floatwindowstyle6");
      }
    },
    exportReportPDF() {
      if (!this.reportpdfurl) {
        this.$alert("该报告暂无pdf可导出！");
      } else {
        let p = {
          prgno: "LIS410",//这里借用下lis410的导出，后台就不单独加一个了
          filename: this.PatientInfo.reportid + "_" + this.PatientInfo.barcode + "_" + this.PatientInfo.pat_name + ".pdf",
          pdfurl: this.reportpdfurl,
        };
        this.$pub.commexport(this, p, p.filename);
      }
    },
    //pdf报告导入
    UploadPDF(file) {
      this.SaveReportandResult(0, this.selectdate, this.rptunitid, "", 1).then((r) => {
        var URL = this.$tool.baseUrl.replace("api", "z") + "fileupload";
        let formData = new FormData();
        console.log("file", file);
        formData.append("file", file);
        formData.append("action", "LIS312");
        formData.append("param1", this.PatientInfo.reportid);
        formData.append("param2", this.rptunitid);
        axios
          .post(URL, formData, { "Content-Type": "multipart/form-data" })
          .then((res) => {
            if (res.data.flag == 1) {
              this.$message.success("保存成功");
              let url = window.URL.createObjectURL(file);
              this.$refs.rmlabresult.image = url;
            } else {
              this.$message.error("错误:" + res.data.msg);
              this.$refs.rmlabresult.image = "";
            }
          })
          .catch((e) => {
            console.log("error", e);
          });
      });
    },
    // 打印之后细菌表
    AfterPrintGermSheet() {
      if (this.Options.printgermsheetnext == "1") {
        this.SpecChangeActionList(1);
      }
    },
    // #endregion 中间结果区域方法库


    // #region 右键事件方法库(这里只有触发事件，其他后续处理在弹窗方法库或者通用方法库中)

    // #region 右键菜单
    RightClick(e) {
      var that = this;
      this.$contextmenu({
        items: that.RightItem,
        event,
        // x: e.clientX + 20,
        // y: e.clientY,
        customClass: "RightBack",
        zIndex: 2999,
        minWidth: 230,
      });
    },
    // #endregion

    // #region 设置
    OpenConfig() {
      // if(this.tableDataColumn && this.tableDataColumn.length > 0 && this.tableDataColumn[0].hasOwnProp)
      // for (let i = 0; i < this.tableDataColumn.length; i++) {
      //     if (this.tableDataColumn[i].default_val != "") {
      //         this.Queryddl("LIS3_" + this.tableDataColumn[i].col_code, "1");
      //     } else {
      //         this.tableDataColumn[i].default_valname = "";
      //     }
      // }
      this.$refs.rmLabReportConfig.OpenConfig();
    },
    // #endregion

    // #region 批量标本录入
    BatchInputSample() {
      var date = this.selectdate;
      if (this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3 || this.Options.batchbarcodeonlytoday == "1") {
        date = this.sysdate + " 00:00:00";
      }
      this.Options.sysdate = this.sysdate;
      this.$refs.rmLabreportBatchcollect.CollectDeal(this.PRGNO, this.rptunitid, date, this.specno, this.Options.batchbarcodeonlytoday, this.Options);
      //this.$refs.rmLabReportConfig.OpenConfig();
    },
    // #endregion

    // #region 查阅病历
    QueryPatCase() {
      this.$pub.getPatcase(this, this.PatientInfo.reportid, 3);
    },
    // #endregion

    // #region 单项合并
    OpenMerge() {
      this.dialogmergeVisible = true;
      this.mergespecno = XE.clone(this.specno, true);
      this.QueryBindmdl();
    },
    // #endregion

    // #region 标本合并(移动)
    OpenLIS322() {
      this.dialogmergespecVisible = true;
    },
    // #endregion

    // #region 审核报告
    CheckReport(thenaction, ptype) {
      if (this.checkingflag) {
        if (!this.CheckingMsgObj) {
          this.CheckingMsgObj = this.$message({
            message: "上一报告正在审核中,请稍候...",
            type: "warning",
            duration: 0,
            showClose: true,
            onClose: () => {
              this.CheckingMsgObj = "";
            },
          });
        }
        return;
      }
      if (this.isalwaysrechkuser == "1") {
        this.$rm_Login({
          type: "用户登录验证",
          btn: {
            confirmBtnText: "确定",
            cancelBtnText: "取消",
          },
        })
          .then((res) => {
            if (res.flag == "1") {
              this.exactusernorhk = res.userid;
              this.exactusernamerhk = res.username;

              if (this.Begincheckmode) {
                this.checksuccess = this.$refs.xTableList.getSelectRecords().filter((item) => item.hasOwnProperty("cp_msg") && item.cp_msg.indexOf("成功") > -1).length;
                this.checkfail = 0;
                this.checkcafail = 0;
                this.SaveReportandResult(0, this.selectdate, this.rptunitid).then(() => {
                  this.BatCheckReport(2);
                });
              } else this.BeforeCheckTips(0, thenaction, ptype);
            } else {
              //登录失败
            }
          })
          .catch((e) => {
            this.closeTag();
          });

      }
      else {
        // this.exactusernorhk = this.exactusernoreport;
        // this.exactusernamerhk = this.exactusernamereport;
        if (this.Begincheckmode) {
          this.checksuccess = this.$refs.xTableList.getSelectRecords().filter((item) => item.hasOwnProperty("cp_msg") && item.cp_msg.indexOf("成功") > -1).length;
          this.checkfail = 0;
          this.checkcafail = 0;
          this.SaveReportandResult(0, this.selectdate, this.rptunitid).then(() => {
            this.BatCheckReport(2);
          });
        } else this.BeforeCheckTips(0, thenaction, ptype);
      }

      //del by liangyjian 2021-04-23 审核前提示
      // if (this.PatientInfo.pat_no == "" && this.PatientInfo.pat_name == "") {
      //     this.$confirm("当前患者没有病人号和病人姓名，确定要继续" + (this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0" ? "签名" : "审核") + "吗?", "提示", {
      //         confirmButtonText: "确定",
      //         cancelButtonText: "取消",
      //         focusCancelButton: true,
      //         closeOnClickModal: false,
      //         type: "warning"
      //     })
      //         .then(() => {

      //         })
      //         .catch(() => {});
      // } else {
      //     var resultdatas = this.$refs.rmlabresult.$refs.xTableResult.tableFullData;
      //     if (resultdatas.length > 0 || this.PRGNO == "LIS311") {
      //         if (this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0" ? !!this.exactusernoreport || !!this.PatientInfo.report_user : this.Options.rechkcoverechkuser == "1" ? this.exactusernorhk : this.PatientInfo.rechk_user) {
      //             this.BeforeCheckReport(thenaction, ptype);
      //         } else {
      //             this.$rm_Login({
      //                 type: this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0" ? "请输入签名者工号和密码" : "请输入审核者工号和密码",
      //                 btn: {
      //                     confirmBtnText: "确定",
      //                     cancelBtnText: "取消"
      //                 }
      //             })
      //                 .then(res => {
      //                     if (res.flag == "1") {
      //                         if (this.Options.checkmustsignname == "1" && this.PatientInfo.rechkflag == "0") {
      //                             this.exactusernoreport = res.userid;
      //                             this.exactusernamereport = res.username;
      //                         } else {
      //                             this.exactusernorhk = res.userid;
      //                             this.exactusernamerhk = res.username;
      //                         }
      //                         this.BeforeCheckReport(thenaction, ptype);
      //                     } else {
      //                         //登录失败
      //                     }
      //                 })
      //                 .catch(e => {
      //                     console.log("error", e);
      //                 });
      //         }
      //     } else {
      //         this.$confirm("当前报告无检验结果无法审核!", "提示", {
      //             confirmButtonText: "确定",
      //             cancelButtonText: "取消",
      //             focusCancelButton: false,
      //             closeOnClickModal: false,
      //             type: "warning"
      //         });
      //     }
      // }
    },
    // #endregion

    // #region 报告预览/打印
    CheckPrint(type) {
      let isctrl = false;
      if (window.event.ctrlKey) isctrl = true;
      this.SaveReportandResult(0, this.selectdate, this.rptunitid).then((r) => {
        if (type == 2) {
          if (isctrl) {
            this.$tool
              .request({
                url: "LIS/LIS3/LIS310",
                method: "post",
                data: {
                  action: "getrptstyleid",
                  reportid: this.PatientInfo.reportid,
                },
              })
              .then((res) => {
                if (res != "")
                  //调整
                  this.$pub.printreport(this, this.PatientInfo.reportid, "3", res);
              });
          } else {
            //预览
            this.PrintFunc(type);
          }
        } else {
          if (this.Options.autocheckbeforeprint > 0) {
            if (this.PatientInfo.rechkflag == "9") {
              this.PrintFunc(type).then(() => {
                if (this.Options.autonextafterprint > 0) this.SpecChangeActionList(1);
              });
            } else {
              this.CheckReport(1, type);
            }
          } else {
            //删除前台对于审核标志的判断，交给后台判断，并且有选项控制审核前就可以打印
            this.PrintFunc(type).then(() => {
              if (this.Options.autonextafterprint > 0) this.SpecChangeActionList(1);
            });
          }
        }
      });
    },
    // #endregion

    // #region 解除审核
    BeforeUnCheckReport(userno) {
      // 解除审核时，如果不是设置了解除审核时需要登录的话，前台一律不传用户，由后台直接取当前登录者
      userno = "";
      if (this.Options.uncheckmustlogon == "1" && !this.loginsucessedflag) {
        this.$rm_Login({
          type: "用户登录验证",
          btn: {
            confirmBtnText: "确定",
            cancelBtnText: "取消",
          },
        })
          .then((res) => {
            if (res.flag == "1") {
              userno = res.userid;
              //登录成功
              this.UnCheckReport(userno);
            } else {
              //登录失败
              this.$message.error("用户登录失败");
            }
          })
          .catch((e) => { });
      } else {
        this.UnCheckReport(userno);
      }
    },
    // #endregion

    // #region 单独上报危急值
    DangerDealForOneItem() {
      if (this.UpdateJudge()) {
        return;
      }
      this.SaveReportandResult(0, this.selectdate, this.rptunitid).then(() => {
        this.dangerreportid = this.PatientInfo.reportid;
        var usr = this.exactusernoreport;
        var usrname = this.exactusernamereport;
        if (this.exactusernoreport == "") {
          usr = this.$tool.getSession(this.$tool.loginuserno);
          usrname = this.$tool.getSession(this.$tool.loginusername);
        }
        this.CurrentCheckUser = { userno: usr, username: usrname };
        this.CurrentReportUser = { userno: usr, username: usrname };
        this.DangerAllflag = true;
        var dangerdata = this.$refs.rmlabresult.tableDataResult.filter((item) => item.alertflag == "1");
        if (dangerdata.length > 0) {
          this.dialogDangerVisible = true;
        } else {
          this.$alert("当前报告无危急值!", "提示");
        }
      });
    },
    // #endregion

    // #region 清除未做
    ClearNoDoItems() {
      if (this.UpdateJudge()) {
        return;
      }
      this.$refs.rmlabresult
        .ClearNoDoItems()
        .then(() => {
          this.SaveAction(0, this.selectdate, this.rptunitid);
        })
        .catch(() => { });
    },
    // #endregion

    // #region 查看日志
    QueryReportLog(tab) {
      if (tab == "tab") {
        this.tableDataRptLogDetail = [];
        this.logid = +new Date();//刷新组件
        if (this.PatientInfo.reportid) {
          this.ReportLogid = this.PatientInfo.reportid;
        }
        else {
          //拼一下报告ID,判断是否为新增报告由后台来做，省的删除日志无法显示
          this.ReportLogid = XE.toDateString(this.selectdate, "yyyyMMdd") + "-" + this.rptunitid + "-" + this.specno;
        }
      }
      else {
        this.dialogReportLogVisible = true;
        if (this.PatientInfo.reportid) {
          this.ReportLogid = this.PatientInfo.reportid;
        } else {
          //拼一下报告ID,判断是否为新增报告由后台来做，省的删除日志无法显示
          this.ReportLogid = XE.toDateString(this.selectdate, "yyyyMMdd") + "-" + this.rptunitid + "-" + this.specno;
        }
      }
    },
    // #endregion

    // #region 撤销结果删除
    UnDoDelete() {
      if (!this.UpdateJudge()) {
        this.SaveReportandResult(0, this.selectdate, this.rptunitid).then((r) => {
          this.$refs.rmlabresult.CancelDel();
        });
      } else {
        this.$alert("当前报告为不可修改状态!", "提示");
      }
    },
    // #endregion

    // #region 当前标本指定复查结果
    SpecifyRedoResult() {
      this.specifyfromsample = "";
      this.specifytosample = "";
      this.specifyRedoResultVisible = true;
    },
    ConfirmSpecifyRedo() {
      if (!this.specifyfromsample && !this.specifytosample) {
        this.$alert("请选填一个样本号！").then(() => {
          this.$refs.tosampleinput.focus();
        });
        return;
      }

      if (this.specifyfromsample && this.specifytosample) {
        this.$alert("只要填一个就可以了~").then(() => {
          this.$refs.tosampleinput.focus();
        });
        return;
      }
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "specifyredoresult",
            reportid: this.PatientInfo.reportid,
            override: this.nocovercurresult ? 0 : 1,
            fromsample: this.specifyfromsample,
            tosample: this.specifytosample,
          },
        })
        .then((res) => {
          if (res.flag == 1) {
            this.$message({
              type: "success",
              message: "相关结果指定复查成功!",
            });
            this.specifyRedoResultVisible = false;
            //如果是把当前样本结果指定到其他样本，需要跳转过去
            if (this.specifytosample) {
              this.specno = this.specifytosample;
              this.SpecNoChange();
            } else {
              //停留在当前标本时刷新结果就可
              this.$refs.rmlabresult.QueryResult(this.PatientInfo);
              if (this.curtabindex == 6) this.QueryRechk();
            }
          } else {
            this.$alert(res.msg, "提示");
          }
        });
    },
    // #endregion

    // #region 指定为质控标本
    SetQcSample() {
      this.SaveReportandResult(0, this.selectdate, this.rptunitid).then((r) => {
        this.dialogToQcVisible = true;
        this.$refs.ToQcdialog.QueryInfo();
      });
    },
    // #endregion

    // #region 注销审核者
    UnCheckUser() {
      this.dialogUnCheckUserVisible = true;
    },
    // #endregion

    // #region 注销检验者
    UnReportUser() {
      this.exactusernoreport = "";
      this.exactusernamereport = "";
    },
    // #endregion

    // #region 混样报告发布
    SeachMixBarcode() {
      this.$router.push({ path: "/LIS335", query: { rptunitid: this.rptunitid, chkuser: this.exactusernorhk } });
    },
    // #endregion

    // #region 输入复查结果
    InputRechkDetail() {
      if (this.UpdateJudge()) {
        return;
      }
      //获取结果中当前选定的项目
      let currentrow = this.$refs.rmlabresult.$refs.xTableResult.getCurrentRow();
      this.SaveReportandResult(0, this.selectdate, this.rptunitid).then((r) => {
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            data: {
              action: "queryredoinput",
              reportid: this.PatientInfo.reportid,
            },
          })
          .then((res) => {
            let alertitems = [];
            this.redoreasonoptions = res.redoreasonoptions;
            this.hasreasonoptionflag = this.redoreasonoptions.length > 0;
            this.tableReChkDetailDialog = [];
            //已上报危急值的项目不允许更改
            if (res.dt && res.dt.length > 0) {
              res.dt.forEach((item) => {
                if (item.alertrelease == "1") {
                  alertitems.push(item.rpt_itemname);
                } else {
                  this.tableReChkDetailDialog.push(item);
                }
              });
            }
            this.dialogRechkDetailVisible = true;
            if (currentrow) {
              //加个1毫秒延时
              setTimeout(() => {
                let alertmsg = "";
                if (alertitems && alertitems.length > 0) {
                  alertmsg = alertitems.join(",");
                  this.$alert("存在以下报告项目已上报危急值，不可更改：" + alertmsg).then(() => {
                    //聚焦结果中选中的项目
                    let row = this.$refs.xtableReChkDetaildialog.tableFullData.find(item => item.rpt_itemcode == currentrow.rpt_itemcode);
                    if (row) {
                      this.$refs.xtableReChkDetaildialog.setCurrentRow(row);
                      this.$refs.xtableReChkDetaildialog.setActiveCell(row, "redo_result");
                    } else {
                      let firstrow = this.$refs.xtableReChkDetaildialog.tableFullData[0];
                      this.$refs.xtableReChkDetaildialog.setCurrentRow(firstrow);
                      this.$refs.xtableReChkDetaildialog.setActiveCell(firstrow, "redo_result");
                    }
                  });
                } else {
                  //聚焦结果中选中的项目
                  let row = this.$refs.xtableReChkDetaildialog.tableFullData.find(item => item.rpt_itemcode == currentrow.rpt_itemcode);
                  if (row) {
                    this.$refs.xtableReChkDetaildialog.setCurrentRow(row);
                    this.$refs.xtableReChkDetaildialog.setActiveCell(row, "redo_result");
                  }
                }
              }, 1);
            }

          })
          .catch(() => {
            this.dialogRechkDetailVisible = true;
          });
      });
    },
    // #endregion

    // #region 清除打印标志
    ClearPrintFlag() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "clearprintcnt",
            reportid: this.PatientInfo.reportid,
          },
        })
        .then((res) => {
          if (res.flag == 1) {
            this.$message({
              type: "success",
              message: "清除打印标记成功!",
            });
            this.PatientInfo.printflag = 0;
            var row = this.$refs.xTableList.tableFullData.filter((item) => item.sampleno == this.specno && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid);
            var indexs = this.GetRowIndex(this.specno, this.selectdate);
            if (indexs.index1 >= 0 || indexs.index2 >= 0) {
              this.tableDataListS[indexs.index1].printflag = 0;
              this.tableDataList[indexs.index2].printflag = 0;
            }
          } else {
            this.$alert(res.msg, "提示");
          }
        });
    },
    // #endregion

    // #region 批次审核
    BatchCheck() {
      this.SaveReportandResult(0, this.selectdate, this.rptunitid);
      this.BatRechkDate = XE.clone(this.selectdate, true);
      this.BatRechkSampleno = "";
      this.BatRechkTips = "";
      this.BatRechkPatType = "";
      this.BatRechkTableData = [];
      this.showRedo = "0";
      this.isautoprint = localStorage.getItem("ISAUTOPRINT");
      this.pattypeOption = this.Options.pattypeOptions;
      this.dialogBactchRechkVisible = true;
    },
    // #endregion

    // #region 今日危急值
    ShowTodayDanger() {
      this.dialogtodaydangerVisible = true;
    },
    // #endregion

    // #region 重打条码
    RePrintBarcode(barcode) {
      if (!barcode) barcode = this.PatientInfo.barcode;
      console.log("print", barcode);
      if (barcode && barcode != "") {
        if (!this.Options.lisbarstyle || this.Options.lisbarstyle == "") {
          this.$alert("没有维护条码样式!", "提示");
        } else {
          this.$pub.printbarcode(this, barcode, "1", this.Options.lisbarstyle, "", "1");
        }
      }
    },
    // #endregion

    // #region 显示图像浮动窗口
    OpenImageFloat() {
      this.QueryImage();
      if (localStorage.getItem("floatwindowstyle1")) this.floatwindowstyle1 = localStorage.getItem("floatwindowstyle1");
      this.dialogimgfloatwindowVisible = true;
    },
    // #endregion

    // #region 显示样本图像浮动窗口
    OpenSampleImageFloat() {
      this.QuerySampleImage();
      if (localStorage.getItem("floatwindowstyle2")) this.floatwindowstyle2 = localStorage.getItem("floatwindowstyle2");
      this.dialogsampleimgfloatwindowVisible = true;
    },
    // #endregion

    // #region 显示按钮浮动窗
    ShowFloatButton() {
      this.InitButton();
      if (localStorage.getItem("floatwindowstyle4")) this.floatwindowstyle4 = localStorage.getItem("floatwindowstyle4");
      var floatbuttonshowmode = localStorage.getItem("RM_LAB_REPORT_BUTTONFLOAT_SHOWMODE");
      this.ButtonListflag = floatbuttonshowmode == "1";
      //this.ButtonList = this.ButtonListAll.filter(item => item.visible == "1");
      this.dialogbuttonfloatwindowVisible = true;
      localStorage.setItem("RM_LAB_REPORT_BUTTONFLOAT", this.dialogbuttonfloatwindowVisible ? "1" : "0");
    },
    // #endregion

    // #region 按钮浮动窗配置
    ConfigButton() {
      this.dialogButtonConfigVisible = true;
      this.$nextTick(() => {
        this.$refs.buttontable.setCurrentRow(this.$refs.buttontable.getData(0));
      });
      this.currentindex = 0;
    },
    // #endregion

    // #region 查看专家知识库
    ShowKnowledge() {
      this.$refs.rmknowledge.ShowInfo(this.PatientInfo.reportid);
    },
    // #endregion

    // #region 发送双工申请
    SendDual() {
      let specno = this.specno;
      let that = this;
      this.$prompt("请输入要发送双工申请的标本号区间（输入如1,2,5-8等格式）", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        showCancelButton: false,
        cancelButtonClass: "el-button el-button--default el-button--small el-button--primary",
        confirmButtonClass: "el-button el-button--default el-button--small",
        focusCancelButton: false,
        closeOnClickModal: false,
        inputValue: specno,
        inputValidator: (v) => {
          if (!v || v == "" || v == null) return "输入的内容不能为空";
        },
      })
        .then(({ value }) => {
          this.$tool
            .request({
              url: "LIS/LIS3/LIS310",
              method: "post",
              data: {
                action: "sendlabdualtask",
                sampledate: that.selectdate,
                rptunitid: that.rptunitid,
                samplenostr: value,
              },
            })
            .then((res) => {
              if (res.flag == "1") {
                this.$message.success(res.msg);
              } else {
                if (res.hasOwnProperty("msg")) {
                  this.$alert(res.msg, "提示");
                } else {
                  this.$alert(res.errmsg, "提示");
                }
              }
            });
        })
        .catch(() => { });
    },
    // #endregion

    // #region 标本退回
    SampleCancel() {
      //this.$router.push("/LIS213");
      if (this.PatientInfo.barcode == "") {
        this.$alert("不能退回条码号为空的标本!", "提示");
      } else {
        this.CancelReason = "";
        if (this.Options.reject_logininfo == "1") {
          // 添加登录验证
          this.$rm_Login({
            type: "用户登录验证",
            btn: {
              confirmBtnText: "确定",
              cancelBtnText: "取消"
            }
          })
            .then(res => {
              console.log("登录返回", res);
              if (res.flag == "1") {
                //登录成功
                this.reject_userno = res.userid;
                if (this.Options.rejectreqmusttell == "1") this.dialogCancelNotifierVisible = true;
                else {
                  this.LPicData = [];
                  this.reqrejectimage = "";
                  this.dialogSmpCancelVisible = true;
                }
              } else {
                //登录失败 关掉功能界面
              }
            })
            .catch(e => {
              // 点击取消 关闭功能界面
              this.closeTag();
              console.log("error", e);
            });
        } else {
          if (this.Options.rejectreqmusttell == "1") this.dialogCancelNotifierVisible = true;
          else {
            this.LPicData = [];
            this.reqrejectimage = "";
            this.dialogSmpCancelVisible = true;
          }
        }
      }
    },
    // #endregion

    // #region 解除签名
    UnSignReport() {
      let reportid = this.PatientInfo.reportid;
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "unsignreport",
            reportid: reportid,
            userno: this.$tool.getSession(this.$tool.loginuserno),
          },
        })
        .then((res) => {
          if (res.flag == "1") {
            this.UnCheckThen(res);
          } else {
            this.$alert(res.msg, "提示");
          }
        });
    },
    // #endregion

    // #region 打开标记需复查窗口
    OpenRechkNeed() {
      if (this.UpdateJudge()) {
        return;
      }
      this.SaveReportandResult(0, this.selectdate, this.rptunitid).then((r) => {
        this.QueryNeedRechk();
      });
    },
    // #endregion

    // #region 批量标记需复查
    BatNeedRechk() {
      if (this.PatientInfo.rechkflag != "9") {
        this.multreviewShow = true;
      }
    },
    // #endregion

    // #region 进入审核模式
    SetCheckMode(type) {
      if (this.batsignmode != type) {
        this.Begincheckmode = true;
        this.batsignmode = type;
      } else {
        this.Begincheckmode = !this.Begincheckmode;
      }
      this.$refs.rmlabresult.Checkmode = this.Begincheckmode;
      //this.Begincheckmode = true;
      if (this.Begincheckmode) {
        this.CheckRows = [];
        this.$emit("OptionsChange", { Options: this.Options, RightItem: [], checkmode: type, Begincheckmode: this.Begincheckmode });
        this.$refs.leftdrag.fixsizeLocal = 1;
        this.$refs.rmlabresult.editflag = false;
        if (this.PRGNO == "LIS310" || this.PRGNO == "LIS314") this.$refs.rmlabresult.RefreshColumns(this.$refs.rmlabresult.tableResultColumn, this.Begincheckmode);
        if (type == 0) {
          this.listStatus = "待审核";
          this.QueryList(1);
        } else {
          this.listStatus = "待签名";
          this.QueryList(1);
        }
      } else {
        this.$emit("OptionsChange", { Options: this.Options, RightItem: [], checkmode: type, Begincheckmode: this.Begincheckmode });
        this.$refs.xTableList.refreshColumn();
        if (this.PRGNO == "LIS310" || this.PRGNO == "LIS314") this.$refs.rmlabresult.RefreshColumns(this.$refs.rmlabresult.tableResultColumn, this.Begincheckmode);
        this.$refs.rmlabresult.editflag = true;
        this.$refs.leftdrag.fixsizeLocal = this.fixleft;
      }
    },
    // #endregion

    // #region 报告数据导入
    UploadRpt() {
      this.importDialog = true;
    },
    // #endregion

    // #region 设置值班医生
    SaveDutyMan() {
      var usr = this.$tool.getSession(this.$tool.loginuserno);
      var usrname = this.$tool.getSession(this.$tool.loginusername);

      let that = this;
      this.$confirm("确定将" + usrname + "[" + usr + "]设置为今日值班检验医生吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "更换值班检验医生",
        focusCancelButton: false,
        closeOnClickModal: false,
        distinguishCancelAndClose: true,
        type: "warning",
        beforeClose: (action, instance, done) => {
          if (action === "confirm") {
            done();
          } else if (action === "cancel") {
            that.$rm_Login({
              type: "值班检验医生",
              btn: {
                confirmBtnText: "确定",
                cancelBtnText: "取消",
              },
            }).then((res) => {
              if (res.flag == "1") {
                that.SaveDutyManRe(res.userid);
              }
            });
            done();
          } else if (action === "close") {
            done();
          }
        },
      }).then(() => {
        this.SaveDutyManRe(usr);
      });
    },
    // #endregion

    // #region 信息加密解密
    PatientInfoEnOrDecry() {
      this.SaveReportandResult(0, this.selectdate, this.rptunitid).then(() => {
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            data: {
              action: "infoEnOrDecry",
              reportid: this.PatientInfo.reportid,
            },
          })
          .then((res) => {
            if (res.hasOwnProperty("flag") && res.flag == "1") {
              let row = this.$refs.xTableList.getCurrentRow();
              this.SetInfoByRow(row);
            } else this.$alert(res.errmsg, "错误");
          })
          .catch((err) => {
            console.log("instrdataerr:" + err);
          });
      });
    },
    // #endregion

    // #region 验证ca签名
    Getcasverifydata(type) {
      return new Promise((s, f) => {
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            data: {
              action: "getcaverifydata",
              reportid: this.PatientInfo.reportid,
            },
          })
          .then((res) => {
            if (res.errcode == "1") {
              var cavretstr = jsObj.CAVerifyDatasParas(res.caparams.caclassname, res.caparams.caparm1, res.caparams.caparm2, res.caparams.caparm3, res.caparams.caparm4, res.caparams.caparm5, res.signdata.keyid, res.signdata.signdata, res.signdata.odata);
              console.log('CA返回：', cavretstr);
              let cavret = JSON.parse(cavretstr);
              if (cavret.code != "1") {
                this.$alert("验证数字签名失败", "提示");
                f();
              }
              else {
                this.$alert("验证数字签名成功", "提示");
                s();
              }

            } else {
              this.$alert(res.errmsg, "提示");
              f();
            }
          })
          .catch((err) => {
            this.$alert(err, "提示");
            f();
          });
      })

    },
    // #endregion

    // #region 更改样本号
    ChangeSampleno() {
      this.SaveReportandResult(0, this.selectdate, this.rptunitid).then(() => {
        this.$prompt("当前样本号: " + this.specno + " ,请输入要更改的新样本号", "样本号更改", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          cancelButtonClass: "el-button el-button--default el-button--small el-button--primary",
          confirmButtonClass: "el-button el-button--default el-button--small",
          focusCancelButton: false,
          beforeClose: (action, instance, done) => {
            if (action == "confirm") {
              this.$tool
                .request({
                  url: "LIS/LIS3/LIS310",
                  method: "post",
                  data: {
                    action: "changesampleno",
                    reportid: this.PatientInfo.reportid,
                    sampleno: instance.inputValue,
                  },
                })
                .then((res) => {
                  if (res.hasOwnProperty("flag") && res.flag == "1") {
                    this.$message.success("样本号修改成功");
                    let row = this.$refs.xTableList.getCurrentRow();
                    row.sampleno = res.newsampleno;
                    this.specno = res.newsampleno;
                    this.SetInfoByRow(row, this.specno).then(() => {
                      row.reportid = this.PatientInfo.reportid;
                      this.ChangeAsTab();
                      this.AfterRefreshSetActive();
                    });
                    // this.PatientInfo.sampleno = res.newsampleno;
                    // this.OldPatientInfo.sampleno = res.newsampleno;
                    done();
                  } else if (res.hasOwnProperty("flag")) this.$message.warning(res.msg);
                  else this.$message.warning(res.errmsg);
                })
                .catch((err) => {
                  done();
                  console.log("instrdataerr:" + err);
                });
            } else done();
          },
        }).then(({ value }) => { });
      });
    },
    // #endregion

    // #region 常用电话
    Queryphonenum() {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "queryphonenum",
            reportid: this.PatientInfo.reportid,
          },
        })
        .then((res) => {
          if (res.errcode == "1") {
            this.tableDataPhonenum = res.phonedata;
            this.phoneShowdata.deptname = res.deptname;
            this.phoneShowdata.deptphone = res.deptphone;
            this.phoneShowdata.wardname = res.wardname;
            this.phoneShowdata.wardphone = res.wardphone;
            this.phoneShowdata.doctorname = res.docname;
            this.phoneShowdata.doctorphone = res.docphone;
            this.dialogPhoneVisible = true;
          } else {
            this.$alert(res.errmsg, "提示");
          }
        });
    },
    // #endregion

    // #region 用户自定义功能
    UserDefineFunction(menuevent) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "userdefinefunction",
            rptunitid: this.rptunitid,
            reportid: this.PatientInfo.reportid,
            menuevent: menuevent,
          },
        })
        .then((res) => {
          if (typeof jsObj != "undefined") {
            if (res.flag == 1) {
              if (res.cmdtype == "EXE") {//exe
                console.log("调用浏览器runexe:" + res.cmdtext);
                jsObj.ReadCard("runexe:" + res.cmdtext);
              } else {//url
                console.log("调用浏览器runurl:" + res.cmdtext);
                jsObj.ReadCard("runurl:" + res.cmdtext);
              }
            }
            else {
              this.$message.error(res.msg);
            }
          } else {
            this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
              confirmButtonText: "确定",
            });
          }
        })
        .catch((e) => {
          console.log("error", e);
        });

    },
    // #endregion

    // #region 项目结果导出
    ItemResultExport() {
      let currentrow = this.$refs.rmlabresult.$refs.xTableResult.getCurrentRow();
      if (currentrow) {
        console.log(currentrow);
        this.exportrptitem = currentrow.rpt_itemcode;
        this.exportrptitemname = currentrow.rpt_itemname;
      } else {
        this.exportrptitem = "";
        this.exportrptitemname = "";
      }
      this.itemResultExportVisible = true;
    },
    LinkItemCancel() {
      this.itemResultExportVisible = false;
    },
    // #endregion

    // #endregion 右键事件方法库


    // #region 左侧病人信息方法库
    // 输入框聚焦
    InputFocus(colcode) {
      this.popdatatype = "LIS3_" + colcode;
      this.Queryddl();
      if (colcode == "specno") {
        this.$refs.specno.select();
      } else if (colcode == "lab_advice" || colcode.indexOf("reserve") > -1 || colcode.indexOf("txtinfo") > -1) {
        this.QueryAdvice(colcode);
        this.$refs[colcode][0].select();
      } else {
        if (colcode.toUpperCase().indexOf("_DT") == -1 && colcode.toUpperCase().indexOf("_DATE") == -1 && colcode.toUpperCase().indexOf("PAT_BIRTH") == -1) {
          this.$refs[colcode][0].select();
        } else {
          this.$refs[colcode][0].focus();
        }
      }
    },
    // 输入框上移下移按键
    InputMove(type, colcode) {
      //0上移1下移
      if (type == 1) {
        var num = 0;
        for (let i = 0; i < this.ColData.length; i++) {
          if (this.ColData[i].col_code == colcode) num = i;
        }
        var nextitem = this.ColData[num + 1];
        num = num + 1;
        if (num < this.ColData.length && num > -1) {
          while (!nextitem.enabled && num < this.ColData.length - 1) {
            nextitem = this.ColData[num + 1];
            num = num + 1;
          }
          //this.$refs[nextitem][0].focus();
          if (this.$refs[nextitem.col_code][0]) {
            if (nextitem.col_code.toUpperCase().indexOf("_DT") == -1 && nextitem.col_code.toUpperCase().indexOf("_DATE") == -1) {
              this.$nextTick(() => {
                this.$refs[nextitem.col_code][0].focus();
              });
            } else {
              //console.log(this.$refs[nextitem.col_code][0]);
              this.$refs[nextitem.col_code][0].focus();
              this.$refs[nextitem.col_code][0].hidePicker();
            }
          }
        } else {
          this.$refs.barcode[0].select();
        }
      } else {
        var num = 0;
        for (let i = 0; i < this.ColData.length; i++) {
          if (this.ColData[i].col_code == colcode) num = i;
        }
        var nextitem = this.ColData[num - 1];
        num = num - 1;
        if (num < this.ColData.length && num > -1) {
          while (!nextitem.enabled && num > 0) {
            nextitem = this.ColData[num - 1];
            num = num - 1;
          }
          //this.$refs[nextitem][0].focus();
          if (this.$refs[nextitem.col_code][0]) {
            if (nextitem.col_code.toUpperCase().indexOf("_DT") == -1 && nextitem.col_code.toUpperCase().indexOf("_DATE") == -1) {
              this.$nextTick(() => {
                this.$refs[nextitem.col_code][0].focus();
              });
            } else {
              this.$refs[nextitem.col_code][0].focus();
              this.$refs[nextitem.col_code][0].hidePicker();
            }
          }
        } else {
          this.$refs.barcode[0].select();
        }
      }
    },
    // 时间选择框改变
    datechangelist(val, colcode) {
      console.log("chagne", colcode, this.PatientInfo[colcode]);
      if (colcode == "pat_birth") {
        if (this.PatientInfo[colcode]) {
          var agearr = this.getAge(this.PatientInfo[colcode]);
          this.PatientInfo.pat_agestr = agearr.agestr;
          this.PatientInfo.pat_ageyear = agearr.ageyear;
        } else {
          this.PatientInfo.pat_agestr = "";
          this.PatientInfo.pat_ageyear = 0.0;
        }
      }
      // else if(colcode == "report_dt"){
      //     console.info("this.report_dt.date.getTime()===="+this.report_dt);
      //     console.info("DateTime.now()===="+new Date());
      //     if(Date.parse(val) > new Date()){

      //         this.PatientInfo.report_dt = XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss");
      //     }
      // }

    },
    // 获取年龄
    getAge(birth) {
      var birthdate = new Date(birth);
      var nowdate = new Date(this.sysdate);

      var birthyear = birthdate.getFullYear();
      var birthmonth = birthdate.getMonth() + 1;
      var bithday = birthdate.getDate();

      var nowyear = nowdate.getFullYear();
      var nowmonth = nowdate.getMonth() + 1;
      var nowday = nowdate.getDate();

      var yearspan = nowyear - birthyear;
      var monthspan = nowmonth - birthmonth;
      var dayspan = nowday - bithday;
      if (dayspan < 0) monthspan--;
      if (monthspan < 0) yearspan--;
      var agestr = "";
      var ageyear = 0;
      if (yearspan > 0) {
        agestr = yearspan + "岁";
        var monthnum = Math.abs(monthspan);
        var daynum = Math.abs(dayspan);
        if (monthspan < 0) monthnum = 12 - Math.abs(monthspan);
        if (dayspan < 0) daynum = 30 - Math.abs(dayspan);
        ageyear = yearspan + monthnum / 12 + daynum / 365;
      } else if (yearspan == 0) {
        var monthnum = Math.abs(monthspan);
        var daynum = Math.abs(dayspan);
        var dayall = 30;
        if (birthmonth == 1 || birthmonth == 3 || birthmonth == 5 || birthmonth == 7 || birthmonth == 8 || birthmonth == 10 || birthmonth == 12) dayall = 31;
        else if (birthmonth == 2) {
          if ((birthyear % 4 == 0 && birthyear % 100 != 0) || birthyear % 400 == 0) dayall = 29;
          else dayall = 28;
        }
        if (monthspan < 0) monthnum = 12 - Math.abs(monthspan);
        if (dayspan < 0) daynum = dayall - Math.abs(dayspan);
        if (monthnum > 0) {
          agestr = monthnum + "月";
          ageyear = monthnum / 12;
        }
        if (daynum > 0) {
          agestr += daynum + "天";
          ageyear = daynum / dayall;
        }
      }
      ageyear = ageyear.toFixed(4);
      return { ageyear: ageyear, agestr: agestr };
    },
    // 回车事件
    EnterEvent(colcode) {
      //  console.log("EnterEvent ", colcode);
      //  if(colcode == "report_dt") {
      //      this.$nextTick(()=>{
      //          console.info("this.report_dt.date.getTime()===="+this.PatientInfo.report_dt, this.PatientInfo);
      //         console.info("DateTime.now()===="+new Date());
      //         if(Date.parse(this.PatientInfo.report_dt) > new Date()){

      //             this.PatientInfo.report_dt = XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss");

      //         }
      //          console.info("this.PatientInfo.report_dt===="+this.PatientInfo.report_dt);
      //      });

      //  }
      this.InputMove(1, colcode);
    },
    // 录入条码
    BarcodeRequest() {
      return new Promise((s, f) => {
        var barcode = this.PatientInfo.barcode;
        var reportid = this.PatientInfo.reportid;
        var sampledate = this.selectdate;
        var sampleno = this.specno;
        // 条码录入前先清空
        this.barcodeinputsuccessflag = false;
        this.barcodePatientInfo = {};
        this.barcodeResult = {};
        this.$pub.Log("开始录入条码号" + barcode);
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            data: {
              action: "inputbarcode",
              rptunitid: this.rptunitid,
              barcode: barcode,
              reportid: reportid,
              sampledate: sampledate,
              sampleno: sampleno,
              oldbarcode: this.oldbarcode,
              reportuser: this.PatientInfo.report_user ? this.PatientInfo.report_user : this.exactusernoreport,
              rptinfo: this.PatientInfo,
              oldrptinfo: this.OldPatientInfo,
              results: this.$refs.rmlabresult.$refs.xTableResult.getRecordset(),
            },
          })
          .then((response) => {
            this.$pub.Log("条码号后台请求结束" + barcode);
            this.barcodePatientInfo = response.report;
            this.barcodeResult = response.results;
            if (response.flag == 1) {
              this.barcodeinputsuccessflag = true;
              if (this.$refs.rmlabresult.tableResultColumn.length == 0) this.$refs.rmlabresult.tableResultColumn = response.results.Cols;
              var hasrow = this.$refs.xTableList.tableFullData.filter((item) => item.sampleno == this.specno && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid);
              if (hasrow.length > 0) {
                var indexs = this.GetRowIndex(this.specno, this.selectdate);
                var index = indexs.index1;
                var index1 = indexs.index2;
                this.tableDataListS[index] = response.report;
                this.tableDataList[index1] = response.report;
                if (this.Options.autonextsample > 0) {
                  this.$refs.xTableList.loadData(this.tableDataListS).then(() => {
                    var row = this.$refs.xTableList.tableFullData.find((item) => item.sampleno == response.report.sampleno && item.sampledate == response.report.sampledate && item.rptunitid == response.report.rptunitid);
                    if (row) {
                      this.$refs.xTableList.scrollToRow(row);
                      this.$refs.xTableList.setCurrentRow(row);
                    }
                    s(response);
                  });
                } else {
                  this.PatientInfo = this.PatientInfoGetname(JSON.parse(JSON.stringify(response.report)));
                  this.OldPatientInfo = this.PatientInfoGetname(JSON.parse(JSON.stringify(response.report)));
                  this.oldbarcode = this.OldPatientInfo.barcode;
                  this.$pub.Log("左侧病人信息赋值完成" + barcode);
                  this.$refs.xTableList.loadData(this.tableDataListS).then(() => {
                    this.$pub.Log("右侧列表刷新本条数据结束" + barcode);
                    var row = this.$refs.xTableList.tableFullData.find((item) => item.sampleno == response.report.sampleno && item.sampledate == response.report.sampledate && item.rptunitid == response.report.rptunitid);
                    if (row) {
                      this.$refs.xTableList.scrollToRow(row);
                      this.$refs.xTableList.setCurrentRow(row);
                    }

                    var that = this;
                    this.$pub.Log("开始查询结果" + barcode);
                    this.$refs.rmlabresult.QueryResult(this.PatientInfo).then((res) => {
                      this.$pub.Log("查询结果结束" + barcode);
                      that.AfterQResult(res.res.reportid, that);
                      s(response);
                    });
                  });
                }
              } else {
                var resreport = response.report;
                resreport.specimen_name = resreport.specimen_codename;//条码录入后得到的结果标本类型和右侧列表查询结果的标本类型不是同一个字段
                this.tableDataListS.push(JSON.parse(JSON.stringify(resreport)));
                this.tableDataList.push(JSON.parse(JSON.stringify(response.report)));
                let that = this;
                setTimeout(() => {
                  var row = that.$refs.xTableList.afterFullData.find((item) => item.sampleno == response.report.sampleno && item.sampledate == response.report.sampledate && item.rptunitid == response.report.rptunitid);
                  if (row) {
                    that.$refs.xTableList.scrollToRow(row);
                    that.$refs.xTableList.setCurrentRow(row);
                    // this.TotalPatNum = this.$refs.xTableList.tableFullData.length;
                    // this.ExactNum = this.$refs.xTableList.tableFullData.filter((item) => item.rechkflag > 0).length;
                    // this.UnExactNum = this.$refs.xTableList.tableFullData.filter((item) => item.rechkflag == 0).length;
                    // this.tempRowIndex = this.$refs.xTableList.tableFullData.filter((item) => item._XID < row._XID).length;
                    that.CalcNum(that.$refs.xTableList.tableFullData);
                  }
                }, 1);
                if (this.Options.autonextsample > 0) {
                  s(response);
                } else {
                  this.PatientInfo = this.PatientInfoGetname(JSON.parse(JSON.stringify(response.report)));
                  this.OldPatientInfo = this.PatientInfoGetname(JSON.parse(JSON.stringify(response.report)));
                  this.oldbarcode = this.OldPatientInfo.barcode;

                  this.$refs.rmlabresult.QueryResult(this.PatientInfo).then(() => {
                    this.AfterQResult(this.PatientInfo.reportid, this);
                    s(response);
                  });
                }
              }

              // this.$nextTick(() => {
              //     // if (this.Options.autonextsample > 0) {
              //     // 下一个会触发保存呢，并且没有.then 并且这个换到下一个标本应该在外面执行 要不保存方法里面也调这个 岂不是乱了
              //     //     this.SpecnoExchange(1, 0);
              //     // }
              // });

              //添加录入条码后自动打印条码的判断
              if (response.barcode && response.barcodeprintcount && response.barcodeprintcount > 0) {
                for (let i = 0; i < response.barcodeprintcount; i++) {
                  this.RePrintBarcode(response.barcode);
                }
              }
              //end
              this.IsSelectPrint(response.barcode, response.report.pat_typecode);
              //this.$refs.rmlabresult.QueryResult(this.PatientInfo);
            } else {
              if (barcode == "") {
                this.PatientInfoClear()
                  .then(() => {
                    f();
                  })
                  .catch(() => {
                    f();
                  });
              } else {
                this.ErrorListDeal(response.msg, response.flag, 0)
                  .then(() => {
                    this.BarcodeSave(response.oldreport)
                      .then(() => {
                        s(response);

                        // 添加录入条码后自动打印条码的判断
                        if (response.barcode && response.barcodeprintcount && response.barcodeprintcount > 0) {
                          for (let i = 0; i < response.barcodeprintcount; i++) {
                            this.RePrintBarcode(response.barcode);
                          }
                        }
                        this.IsSelectPrint(response.barcode, response.report.pat_typecode);
                        //end
                      })
                      .catch(() => {
                        if (this.Options.caninputnoreqbarcode != "1") this.PatientInfo.barcode = "";
                        f();
                      });
                  })
                  .catch((e) => {
                    this.OldPatientInfo = this.PatientInfoGetname(response.oldreport);
                    if (this.Options.caninputnoreqbarcode != "1") {
                      this.PatientInfoClear()
                        .then(() => {
                          //比如确认消息 用户选择了取消
                          f();
                        })
                        .catch(() => {
                          f();
                        });
                    } else f();
                  });
              }
            }
          })
          .catch((error) => {
            this.$alert("录入条码号过程中发生错误，请刷新页面后重试！", "错误", {
              confirmButtonText: "确定",
            });
            this.PatientInfoClear()
              .then((r) => {
                f(); //不管清空病人信息是否成功， 对于条码号录入来说，都是f()
              })
              .catch((e) => {
                f();
              });
          });
      });
    },
    // 条码保存
    BarcodeSave(oldreport) {
      return new Promise((s, f) => {
        var bybarcode = "1";
        if (this.barcodePatientInfo.barcode == "" && this.PatientInfo.barcode != "" && this.Options.caninputnoreqbarcode == "1") {
          this.barcodePatientInfo.barcode = XE.clone(this.PatientInfo.barcode, true);
          bybarcode = "0";
        }
        this.PatientInfo = this.PatientInfoGetname(JSON.parse(JSON.stringify(this.barcodePatientInfo)));
        try {
          if (this.barcodeResult && this.barcodeResult.Data) {
            if (this.barcodeResult.Data.length > 0) {
              if (this.barcodeResult.Data) {
                if (this.barcodeResult.Data.length > 0) {
                  for (let i = 0; i < this.barcodeResult.Data.length; i++) {
                    if (this.$refs.rmlabresult.$refs.xTableResult.tableFullData.filter((item) => item.rpt_itemcode == this.barcodeResult.Data[i].rpt_itemcode).length == 0) this.$refs.rmlabresult.$refs.xTableResult.insertAt(this.barcodeResult.Data[i], -1);
                  }
                }
                this.$refs.rmlabresult.$refs.xTableResult.tableFullData = this.barcodeResult.Data;
                if (this.$refs.rmlabresult.tableResultColumn.length == 0) this.$refs.rmlabresult.tableResultColumn = this.barcodeResult.Cols;
              }
            } else {
              this.$refs.rmlabresult.ClearTableDate();
            }
          }
        } catch (e) {
          console.log("ex  ", e);
        }
        this.SaveAction(0, this.selectdate, this.rptunitid, "", bybarcode, oldreport)
          .then(() => {
            var row = this.$refs.xTableList.tableFullData.filter((item) => item.sampleno == this.PatientInfo.sampleno && item.sampledate == this.selectdate && item.rptunitid == this.PatientInfo.rptunitid)[0];
            this.$refs.xTableList.scrollToRow(row);
            this.$refs.xTableList.setCurrentRow(row);

            s();
          })
          .catch(() => {
            f();
          });
      });

      // this.SaveReportandResult(0, this.selectdate, this.rptunitid);
    },
    //扫描条码时是否打印
    IsSelectPrint(barcode, pattype) {
      console.log(barcode, pattype);
      var printflag = true;
      if (this.Options.noprintreqpattype && ("," + this.Options.noprintreqpattype + ",").indexOf("," + pattype + ",") > -1) printflag = false;
      if (printflag) {
        switch (this.Options.inputbarcodeprintreq) {
          case "0":
            //不打印
            break;
          case "1":
            //总是打印
            this.PrintSelectWays(barcode);
            break;
          case "2":
            //开窗核收才打印
            if (this.$refs.rmLabReportCollect.dialogCollectVisible) {
              //只有normalRcvFlag="Y"的打印
              this.PrintSelectWays(barcode);
            }
            break;
        }
      }
    },
    PrintSelectWays(barcode) {
      let that = this;
      //打印检验申请单（此处要做修改）
      let sql = "select 1 as 条数,* from req_master_all_name where 条码号 in ('" + barcode + "')";
      if (!this.Options.collectreqstyle || this.Options.collectreqstyle == "") {
        this.$alert("没有维护核收申请单样式!", "提示");
      } else {
        that.$pub.printlistbill(that, sql, "1", that.Options.collectreqstyle, "核收检验申请单样式", "");
      }
    },
    // 病人号录入
    PatnoGetInfo(value, type) {
      return new Promise((s, f) => {
        // const loading = this.$loading({
        //     lock: true,
        //     text: "获取病人信息中",
        //     spinner: "el-icon-loading",
        //     background: "rgba(255, 255, 255, 0.7)",
        // });
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            data: {
              action: "inputpatno",
              pat_no: value,
              reportid: this.PatientInfo.reportid,
              barcode: this.PatientInfo.barcode,
              oldrptinfo: this.OldPatientInfo,
              rptinfo: this.PatientInfo,
              results: this.$refs.rmlabresult.$refs.xTableResult.getRecordset(),
              rptunitid: this.rptunitid,
              sampledate: this.selectdate,
              sampleno: this.specno,
            },
          })
          .then((res) => {
            this.PatientInfo = this.PatientInfoGetname(res.report);
            this.OldPatientInfo = this.PatientInfoGetname(res.report);
            this.oldbarcode = this.OldPatientInfo.barcode;
            var newflag = this.tableDataListS.findIndex((item) => item.sampleno == this.PatientInfo.sampleno && item.sampledate == this.PatientInfo.sampledate && item.rptunitid == this.rptunitid) < 0;
            console.log("newflag", newflag);
            if (newflag) {
              this.tableDataListS.push(JSON.parse(JSON.stringify(this.PatientInfo)));
            } else {
              var indexs = this.GetRowIndex(this.PatientInfo.sampleno, this.PatientInfo.sampledate);
              var index = indexs.index1;
              var index1 = indexs.index2;
              this.tableDataListS[index] = this.PatientInfo;
              this.tableDataList[index1] = this.PatientInfo;
              var row = this.$refs.xTableList.afterFullData.find((item) => item.reportid == this.PatientInfo.reportid);
              for (var key in row) {
                if (this.PatientInfo.hasOwnProperty(key)) {
                  row[key] = this.PatientInfo[key];
                }
              }
            }
            if (res.flag == 1) {
              if (res.msg) {
                this.$alert(res.msg, "提示");
              }
              //this.Options.inputitembtpatno = "1";
              if (res.havereqitem == "1" && res.reqtable) {
                this.poppatient = res.lispatinfo.patient;
                // this.tableDataHisReturn = res.reqtable.Data;
                this.tableDataHisReturnAll = res.reqtable.Data;
                this.tableDataHisReturn = res.reqtable.Data.filter((t) => t.rmmemo1 == "1").sort((a, b) => this.sortPatPopReqItemList(a, b));
                this.tableColumnHisReturn = res.reqtable.Cols;
                this.showallrptitem = false;
                this.dialogRptItemVisible = true;
                this.rpt_itemall = this.Options.popitemautoselect == 1;
                this.$nextTick(() => {
                  this.$refs.savepopreqbtn.$el.focus();
                });
                this.filterHisReq();
              }
              //无检验申请信息也可开窗选择申请项目
              else if (this.Options.inputitembtpatno == "1") {
                //申请项目
                this.dialogreqtype = "1";
                this.tableDataDialogreqSelect = [];
                this.$tool
                  .request({
                    url: "LIS/LIS3/LIS310",
                    method: "post",
                    data: {
                      action: "getrptunitreqitem",
                      sampleno: this.specno,
                      rptunitid: this.rptunitid,
                    },
                  })
                  .then((res) => {
                    this.tableDataDialogreqAll = res.data;
                  });
                this.dialogreqVisible = true;
              } else {
                if (this.Options.autonextpatno > 0) {
                  this.SpecChangeAction(1);
                } else {
                  var num = 0;
                  for (let i = 0; i < this.ColData.length; i++) {
                    if (this.ColData[i].col_code == type) num = i;
                  }
                  this.$refs[this.ColData[num + 1].col_code][0].select();
                }
              }
              //loading.close();
              //this.$refs.xTableList.tableData[this.tempRowIndex] = this.PatientInfo;
              s();
            } else {
              //loading.close();
              if (res.flag == -1) {
                this.$alert(res.msg, "错误", {
                  confirmButtonText: "确定",
                })
                  .then(() => {
                    // this.PatientInfo.pat_no = "";
                    // this.OldPatientInfo.pat_no = "";
                    f();
                  })
                  .catch(() => {
                    f();
                  });
              } else {
                // this.PatientInfo.pat_no = value;
                // this.OldPatientInfo.pat_no = value;
                if (this.Options.autonextpatno > 0) {
                  this.SpecChangeAction(1);
                } else {
                  var num = 0;
                  for (let i = 0; i < this.ColData.length; i++) {
                    if (this.ColData[i].col_code == type) num = i;
                  }
                  this.$refs[this.ColData[num + 1].col_code][0].select();
                }
                s();
              }
            }
          })
          .catch(() => {
            //loading.close();
            f();
          });
      });
    },
    //input输入框双击事件
    async inputdblEvent(colcode) {
      this.popdatatype = "LIS3_" + colcode;
      let selitem = this.tableDataColumn.find((item) => item.col_code == colcode);
      var noeit = this.PatientInfo.barcode && this.PatientInfo.barcode.length > 0 && this.Options.bardisablecols && this.Options.bardisablecols.indexOf(colcode) > -1;
      if ((selitem && selitem.noedit) || noeit) {
        return;
      }
      let canruncontinue = true;
      var needlogon = this.PatientInfo.barcode && this.PatientInfo.barcode.length > 0 && this.Options.logonbardisablecols && this.Options.logonbardisablecols.indexOf(colcode) > -1;
      if (needlogon) {
        await this.$rm_Login({
          type: "用户登录验证",
          btn: {
            confirmBtnText: "确定",
            cancelBtnText: "取消",
          },
        })
          .then((res) => {
            if (res.flag == "1") {
              //登录成功
              canruncontinue = true;
              console.log("登录成功");
            } else {
              //登录失败
              this.$message.error("用户登录失败");
              canruncontinue = false;
            }
          })
          .catch((e) => {
            canruncontinue = false;
          });
      }
      if (!canruncontinue) return;
      if (colcode === "pat_agestr") {
        if (this.PatientInfo[colcode]) {
          var re1 = new RegExp("\\d+(?=" + this.radiofatherunit + ")", "g");
          var re2 = new RegExp("\\d+(?=" + this.radiosonunit + ")", "g");
          var age1 = this.PatientInfo[colcode].match(re1);
          var age2 = this.PatientInfo[colcode].match(re2);
          if (age1) {
            this.inputfatherage = age1[0];
          } else {
            this.inputfatherage = "";
          }
          if (age2) {
            this.inputsonage = age2[0];
          } else {
            this.inputsonage = "";
          }
          this.reagestrch = this.PatientInfo[colcode];
        }

        this.dialogAgeVisible = true;
      } else if ((colcode == "lab_advice" && this.Options.labadvicechoose != "1") || colcode.indexOf("reserve") > -1 || colcode.indexOf("txtinfo") > -1) {
        //this.advicetxt = this.PatientInfo[colcode].replace(/\\n/g, "\n");
        this.QueryAdvice(colcode);
        if (localStorage.getItem("floatwindowstyle3")) this.floatwindowstyle3 = localStorage.getItem("floatwindowstyle3");
        this.dialogAdvicefloatwindowVisible = true;
      } else {
        this.poptitle = selitem.col_name;
        this.popdatatype = "LIS3_" + colcode;
        this.dialogTableVisible = true;
      }
    },
    // 确认更改病人号
    ExecPatNoChange(value, type) {
      return new Promise((s, f) => {
        // if (this.Options.nocoverreportinfo == 1) {
        //     this.changekeyflag = false;
        //     // if (this.PatientInfo.barcode || this.PatientInfo.pat_name) {
        //     //     this.$confirm("当前标本已有病人信息，不能录入", "提示", {
        //     //         confirmButtonText: "确定",
        //     //         cancelButtonText: "取消",
        //     //         focusCancelButton: false,
        //     //         closeOnClickModal:false,
        //     //         type: "warning"
        //     //     });
        //     // }
        // } else {
        //病人号则只要判断之前的病人号是不是空，不是空就要确认
        var hasdata = this.$refs.xTableList.tableFullData.find((item) => item.sampleno == this.specno && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid);
        var samplenpo = "";
        if (hasdata) samplenpo = hasdata.sampleno;
        else samplenpo = this.specno;
        if (this.PatientInfo.pat_no != this.OldPatientInfo.pat_no && this.OldPatientInfo && this.OldPatientInfo.pat_no && this.OldPatientInfo.pat_no != "") {
          if (this.Options.nocoverreportinfo == "1") {
            this.PatientInfo.pat_no = this.OldPatientInfo.pat_no;
            this.changekeyflag = false;
            this.$alert("病人号不可修改!");
            return;
            f();
          }
          this.$confirm("确定要修改病人号吗？", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            focusCancelButton: true,
            closeOnClickModal: false,
            type: "warning",
          })
            .then(() => {
              this.PatnoGetInfo(value, type)
                .then(() => {
                  this.changekeyflag = false;
                  var row = this.$refs.xTableList.tableFullData.filter((item) => item.sampleno == samplenpo && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid)[0];
                  this.$refs.xTableList.setCurrentRow(row);
                  // this.SaveAction(0, this.selectdate, this.rptunitid)
                  //     .then(() => {
                  //         var row = this.$refs.xTableList.tableFullData.filter(item => item.sampleno == samplenpo && item.sampledate == this.selectdate)[0];
                  //         this.$refs.xTableList.setCurrentRow(row);
                  //         this.changekeyflag = false;
                  //         s();
                  //     })
                  //     .catch(() => {
                  //         this.changekeyflag = false;
                  //         s();
                  //     });
                })
                .catch(() => {
                  this.changekeyflag = false;
                  var row = this.$refs.xTableList.tableFullData.filter((item) => item.sampleno == samplenpo && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid)[0];
                  this.$refs.xTableList.setCurrentRow(row);
                  // this.SaveAction(0, this.selectdate, this.rptunitid)
                  //     .then(() => {
                  //         var row = this.$refs.xTableList.tableFullData.filter(item => item.sampleno == samplenpo && item.sampledate == this.selectdate)[0];
                  //         this.$refs.xTableList.setCurrentRow(row);
                  //         this.changekeyflag = false;
                  //         s();
                  //     })
                  //     .catch(() => {
                  //         this.changekeyflag = false;
                  //         s();
                  //     });
                });
            })
            .catch(() => {
              this.PatientInfo.pat_no = this.OldPatientInfo.pat_no;
              this.changekeyflag = false;
              f();
            });
        } else {
          this.PatnoGetInfo(value, type)
            .then(() => {
              this.changekeyflag = false;
              var row = this.$refs.xTableList.tableFullData.filter((item) => item.sampleno == samplenpo && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid)[0];
              this.$refs.xTableList.setCurrentRow(row);

              // this.SaveAction(0, this.selectdate, this.rptunitid)
              //     .then(() => {
              //         var row = this.$refs.xTableList.tableFullData.filter(item => item.sampleno == samplenpo && item.sampledate == this.selectdate)[0];
              //         this.$refs.xTableList.setCurrentRow(row);
              //         this.changekeyflag = false;
              //     })
              //     .catch(() => {
              //         this.changekeyflag = false;
              //     });
            })
            .catch(() => {
              this.changekeyflag = false;
              var row = this.$refs.xTableList.tableFullData.filter((item) => item.sampleno == samplenpo && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid)[0];
              this.$refs.xTableList.setCurrentRow(row);

              // this.SaveAction(0, this.selectdate, this.rptunitid)
              //     .then(() => {
              //         var row = this.$refs.xTableList.tableFullData.filter(item => item.sampleno == samplenpo && item.sampledate == this.selectdate)[0];
              //         this.$refs.xTableList.setCurrentRow(row);
              //         this.changekeyflag = false;
              //     })
              //     .catch(() => {
              //         this.changekeyflag = false;
              //     });
            });
        }
        //}
      });
    },
    // 输入框改变事件
    async inputChangeEvent(value, type) {
      let canruncontinue = true;
      //输入条码后可更改列，但需要登录验证
      var needlogon = this.PatientInfo.barcode && this.PatientInfo.barcode.length > 0 && this.Options.logonbardisablecols && this.Options.logonbardisablecols.indexOf(type) > -1;
      if (needlogon) {
        await this.$rm_Login({
          type: "用户登录验证",
          btn: {
            confirmBtnText: "确定",
            cancelBtnText: "取消",
          },
        })
          .then((res) => {
            if (res.flag == "1") {
              //登录成功
              canruncontinue = true;
              console.log("登录成功");
            } else {
              //登录失败
              this.$message.error("用户登录失败");
              canruncontinue = false;
            }
          })
          .catch((e) => {
            canruncontinue = false;
          });
      }
      if (!canruncontinue) {
        //返回原来的值
        this.PatientInfo[type] = this.OldPatientInfo[type];
        return;
      }
      if (!this.changekeyflag) {
        if (this.Options.inputasreportuser != "1") {
          this.PatientInfo.report_username = this.exactusernamereport;
          this.PatientInfo.report_user = this.exactusernoreport;
        }
        switch (type) {
          case "pat_no":
            this.changekeyflag = true;
            this.ExecPatNoChange(value, type)
              .then(() => {
                this.changekeyflag = false;
              })
              .catch(() => {
                this.changekeyflag = false;
              });

            break;
          case "barcode":
            this.changekeyflag = true;
            // var hasdata = this.$refs.xTableList.tableFullData.filter(item => item.sampleno == this.specno);
            // if (this.PatientInfo.barcode != this.oldbarcode && hasdata.length > 0) {
            //     if (hasdata[0].pat_name || hasdata[0].pat_no || hasdata[0].pat_typecode) {
            //     }
            // }
            if (this.nottodayalertflag && this.sysdate + " 00:00:00" != this.selectdate) {
              this.$confirm("当前选择日期不是今天，是否确定录入该条码？", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                focusCancelButton: false,
                closeOnClickModal: false,
                type: "warning",
              })
                .then(() => {
                  this.ExecBarcodeChange()
                    .then(() => {
                      //提醒一次不再提醒
                      this.nottodayalertflag = false;
                      this.CheckSamples(this.barcodePatientInfo);
                      this.changekeyflag = false;
                    })
                    .catch(() => {
                      this.changekeyflag = false;
                    });
                })
                .catch(() => {
                  this.changekeyflag = false;
                });
            } else {
              this.ExecBarcodeChange()
                .then(() => {
                  this.CheckSamples(this.barcodePatientInfo);
                  this.changekeyflag = false;
                })
                .catch(() => {
                  this.changekeyflag = false;
                });
            }

            break;
          case "pat_name":
            var hasdata = this.$refs.xTableList.tableFullData.find((item) => item.sampleno == this.specno && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid);
            var samplenpo = "";
            if (hasdata) samplenpo = hasdata.sampleno;
            else samplenpo = this.specno;
            if (this.PatientInfo.pat_name != this.OldPatientInfo.pat_name && this.OldPatientInfo && this.OldPatientInfo.pat_name && this.OldPatientInfo.pat_name != "") {
              this.$confirm("确定要修改病人姓名吗？", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                focusCancelButton: false,
                closeOnClickModal: false,
                type: "warning",
              })
                .then(() => {
                  this.SaveReportandResult(0, this.selectdate, this.rptunitid).then(() => {
                    this.savepatnametoqcdata(this.PatientInfo.pat_name, this.PatientInfo.reportid);
                  });
                })
                .catch(() => {
                  this.PatientInfo.pat_name = this.OldPatientInfo.pat_name;
                });
            } else {
              this.SaveReportandResult(0, this.selectdate, this.rptunitid).then(() => {
                this.savepatnametoqcdata(this.PatientInfo.pat_name, this.PatientInfo.reportid);
              });
            }
            break;
        }
      }
    },
    // 将当前报告数据指定到质控
    savepatnametoqcdata(pat_name, reportid) {
      //固定录入的值范围位QC+1-9的数字 或者QCH、QCM、QCL 才进行质控
      if (this.PatientInfo.pat_name && this.PatientInfo.pat_name.indexOf("QC") > -1 && this.PatientInfo.pat_name.length == 3) {
        var lvl = this.PatientInfo.pat_name.substring(2);
        if ((!isNaN(parseInt(lvl)) && parseInt(lvl) >= 1 && parseInt(lvl) <= 9) || lvl == "H" || lvl == "L" || lvl == "M") {
          this.$confirm("你是否要将当前报告数据指定到质控（水平：" + lvl + "）？", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            focusCancelButton: false,
            closeOnClickModal: false,
            type: "warning",
          })
            .then(() => {
              this.$tool
                .request({
                  url: "LIS/LIS3/LIS310",
                  method: "post",
                  data: {
                    action: "patnametoqcdata",
                    rptunitid: this.rptunitid,
                    reportid: reportid,
                    qclvl: lvl,
                  },
                }).then((res) => {
                  // if (res.flag==1) {
                  //     this.$alert(res.msg);
                  // }
                  this.$alert(res.msg);
                })
                .catch((e) => {
                  console.log(e);
                });
            })
            .catch(() => {
              this.PatientInfo.pat_name = this.OldPatientInfo.pat_name;
            });
        }
      }
    },
    // 鼠标拖动事件
    tooltipmousover(col, valuetype) {
      if (valuetype == 5) {
        this.tooltipcontent = this.PatientInfo[col + "name"];
        if (this.tooltipcontent && this.tooltipcontent.length > 12) {
          this.tooltipsdiable = false;
        } else {
          this.tooltipsdiable = true;
        }
      } else if (valuetype != 7) {
        this.tooltipcontent = this.PatientInfo[col];
        if (this.tooltipcontent && this.tooltipcontent.length > 12) {
          this.tooltipsdiable = false;
        } else {
          this.tooltipsdiable = true;
        }
      }
    },
    // 确认条码号更改
    ExecBarcodeChange() {
      return new Promise((s, f) => {
        // console.log("this.oldbarcode", this.oldbarcode);
        // console.log("this.PatientInfo", this.PatientInfo);
        // console.log("this.PatientInfo.pat_name", this.PatientInfo.pat_name);
        //弹不弹提示和右侧列表没有关系，只要判断当前页面的显示， 姓名和原条码 有没有值就可以
        //也不需要判断 oldbarcode是否等于新输入的值，因为只有输入的条码号变化了，才会触发change事件
        if ((this.oldbarcode && this.oldbarcode != "") || (this.PatientInfo && this.PatientInfo.pat_name && this.PatientInfo.pat_name != "")) {
          if (this.Options.nochangebarcode == "1") {
            this.PatientInfo.barcode = this.oldbarcode;
            this.changekeyflag = false;
            this.$alert("条码号不可修改!");
            return;
            f();
          }
          this.$confirm("确定要修改条码号/申请号吗?", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            focusCancelButton: false,
            closeOnClickModal: false,
            type: "warning",
          })
            .then(() => {
              this.BarcodeRequest()
                .then((res) => {
                  //为啥要调保存？
                  // this.SaveAction(0, this.selectdate, this.rptunitid).then(() => {
                  //     this.changekeyflag = false;
                  // });
                  this.afterBarcodeInputSuccess(res).then(() => {
                    //此方法只返回then，所以没必要判断catch
                    this.changekeyflag = false;
                    s();
                  });
                })
                .catch(() => {
                  if (this.Options.caninputnoreqbarcode != "1") {
                    this.PatientInfo.barcode = ""; //出错的话，条码号一律清空
                    this.oldbarcode = "";
                    this.OldPatientInfo.barcode = "";
                  }
                  this.changekeyflag = false;
                  f();
                });
            })
            .catch(() => {
              this.PatientInfo.barcode = this.oldbarcode; //用户取消了修改条码号
              this.changekeyflag = false;
              f();
            });
        } else {
          this.BarcodeRequest()
            .then((res) => {
              this.afterBarcodeInputSuccess(res).then(() => {
                this.changekeyflag = false;
                s();
              });
            })
            .catch((e) => {
              if (this.Options.caninputnoreqbarcode != "1") {
                this.PatientInfo.barcode = ""; //出错的话，条码号一律清空
                this.oldbarcode = "";
                this.OldPatientInfo.barcode = "";
              }
              this.changekeyflag = false;
              f();
            });
        }
      });
    },
    // 条码录入成功后
    async afterBarcodeInputSuccess(res) {
      // 核收后自动打印细菌流程单
      if (this.Options.inputprintgermsheet > 0) {
        if (this.Options.germsheetid > 0) {
          if (this.barcodePatientInfo && this.barcodePatientInfo.reportid) {
            this.$pub.printgermsheet(this, this.barcodePatientInfo.reportid, this.Options.germsheetid, "1");
          }
        } else {
          this.$message.error("没有维护细菌流程单样式！");
        }
      }
      if (this.Options.autonextsample > 0) {
        if (res.othermsg && res.othermsg.showMsg != null && res.othermsg.showMsg.length > 0) {
          await this.showlistmsg(res.othermsg.showMsg);
          //录入完自动下一个
          this.$pub.Log("开始自动下一个");
          this.SpecChangeAction(1, 0); // 跳转到下一个的方法并不是异步方法，这么调用就可以
        } else {
          //录入完自动下一个
          this.$pub.Log("开始自动下一个");
          this.SpecChangeAction(1, 0); // 跳转到下一个的方法并不是异步方法，这么调用就可以
        }
      } else if (this.Options.inputautoreqpage == "1") {
        //条码号录入完成自动跳转申请tab页
        if (this.Tablist.split(",").indexOf("5") > -1) {
          this.tabvalue = "5";
          this.curtabindex = 5;
          this.QueryApply();
          this.QueryApplyItem();
        }
      } else {
        if (res.othermsg && res.othermsg.showMsg != null && res.othermsg.showMsg.length > 0) {
          await this.showlistmsg(res.othermsg.showMsg);
        }
        if (this.Tablist.split(",").indexOf("5") > -1 && this.tabvalue == "5" && this.curtabindex == 5) {
          //如果本来就在申请tab页，录入完要查询下申请信息
          this.QueryApply();
          this.QueryApplyItem();
        } else {
          var row = this.$refs.xTableList.tableFullData.find((item) => item.sampleno == this.specno && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid);
          if (row) this.$refs.xTableList.setCurrentRow(row);
        }
      }
    },
    // 显示录入消息
    async showlistmsg(showMsgLst) {
      if (showMsgLst) {
        let id = 0;
        while (id < showMsgLst.length) {
          try {
            let content = showMsgLst[id].content;
            if (content) {
              let title = showMsgLst[id].title;
              if (!title) {
                title = "提示";
              }
              await this.$alert(content, title);
            }
          }
          catch { }
          id++;
        }
      }
    },
    // 输入框改变
    async popinputchange(value, item) {
      let type = item.col_code;
      let canruncontinue = true;
      //输入条码后可更改列，但需要登录验证
      var needlogon = this.PatientInfo.barcode && this.PatientInfo.barcode.length > 0 && this.Options.logonbardisablecols && this.Options.logonbardisablecols.indexOf(type) > -1;
      if (needlogon) {
        await this.$rm_Login({
          type: "用户登录验证",
          btn: {
            confirmBtnText: "确定",
            cancelBtnText: "取消",
          },
        })
          .then((res) => {
            if (res.flag == "1") {
              //登录成功
              canruncontinue = true;
              console.log("登录成功");
            } else {
              //登录失败
              this.$message.error("用户登录失败");
              canruncontinue = false;
            }
          })
          .catch((e) => {
            canruncontinue = false;
          });
      }
      if (!canruncontinue) {
        //返回原来的值
        if (type == "pat_sex" || (item.valuetype == "5" && type != "pat_agestr")) {
          this.PatientInfo[type + 'name'] = this.OldPatientInfo[type + 'name'];
        }
        else {
          this.PatientInfo[type] = this.OldPatientInfo[type];
        }
        return;
      }
      if (this.Options.inputasreportuser != "1" && type != "rechk_user" && type != "report_user") {
        this.PatientInfo.report_username = this.exactusernamereport;
        this.PatientInfo.report_user = this.exactusernoreport;
      }
      switch (type) {
        case "pat_agestr":
          var reg = new RegExp("\\d{1,}(y|Y|岁|年){0,}\\d{0,}(m|M|月){0,}\\d{0,}(d|D|日){0,}\\d{0,}(h|H|小时){0,}\\d{0,}(f|F|分钟){0,}", "gi");
          var regd = new RegExp("^\\d{1,}$", "gi");
          var regda = new RegExp("\\d{1,}", "gi");
          if (value.match(regd)) {
            this.PatientInfo[type] = value + "岁";
            this.PatientInfo["pat_ageyear"] = value - 0;
          } else if (value.match(reg)) {
            this.PatientInfo[type] = value.replace("y", "岁").replace("年", "岁").replace("Y", "岁").replace("m", "月").replace("M", "月").replace("d", "日").replace("D", "日").replace("h", "小时").replace("H", "小时").replace("f", "分钟").replace("F", "分钟") + "";
            this.PatientInfo.pat_ageyear = this.ageTransform(this.PatientInfo.pat_agestr);
          } else {
            this.$confirm("无效的病人年龄!", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              focusCancelButton: false,
              closeOnClickModal: false,
              type: "warning",
            })
              .then(() => { })
              .catch(() => { });
          }
          break;
        case "lab_advice":
        case "reserve1":
        case "reserve2":
        case "reserve3":
        case "reserve4":
        case "reserve5":
        case "txtinfo1":
        case "txtinfo2":
          var list = this.InputCodeArr.filter((item) => item.key == this.popdatatype);
          if (list.length > 0) {
            var row = list[0].list.filter((item) => (item.txtinfo + "").toUpperCase() == (value + "").toUpperCase() || (item.txttitle + "").toUpperCase() == (value + "").toUpperCase() || (item.inputcode + "").toUpperCase() == (value + "").toUpperCase());
            if (row.length > 0) {
              this.PatientInfo[type] = row[0].txtinfo;
            }
          }
          break;
        case "markreason":
          this.markreasonpasseditflag = false;
          break;
        case "pat_diag":
          this.PatientInfo[type] = value;
          break;
        default:
          let selitem = this.tableDataColumn.find((item) => item.col_code == type);
          if (selitem && selitem.noedit) {
            return;
          }
          if (value.trim()) {
            var list = this.InputCodeArr.filter((item) => item.key == this.popdatatype);
            if (list.length > 0) {
              var row = list[0].list.Data.filter((item) => (item.inputcode + "").toUpperCase() == (value + "").toUpperCase() || (item.hidkey + "").toUpperCase() == (value + "").toUpperCase());
              if (row.length > 0) {
                if (type == "rechk_user" || type == "report_user") {
                  this.usercode = row[0].hidkey;
                  this.username = row[0].hidname;
                  this.userpwd = "";
                  this.dialogLoginVisible = true;
                  this.$nextTick(() => {
                    this.$refs.loginpwd.focus();
                  });
                } else {
                  this.PatientInfo[type + "name"] = row[0].hidname;
                  this.PatientInfo[type] = row[0].hidkey;
                }
              } else {
                if (type == "pat_sex" || type == "pat_typecode" || type == "specimen_code" || type == "rechk_user" || type == "report_user") {
                  this.dialogTableVisible = true;
                } else {
                  var re = new RegExp("[\\u4e00-\\u9fa5]", "gi");
                  if (!re.test(value)) {
                    this.dialogTableVisible = true;
                  }
                }
              }
            }
          } else {
            this.PatientInfo[type] = "";
          }
          break;
      }
    },
    // 输入框空格事件
    SpaceEvent(type) {
      var val = this.PatientInfo[type + "name"];
      if (!val.replace(/\s*/g, "")) {
        this.inputdblEvent(type);
      }
    },
    //读卡
    ReadCard() {
      if (!this.imgUrl) {
        if (typeof jsObj != "undefined") {
          var patno = jsObj.ReadCard(this.Options.readcardcmdline);
          this.PatientInfo.pat_no = patno;
          this.inputChangeEvent(patno, "pat_no");
        } else {
          this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
            confirmButtonText: "确定",
          });
        }
      }
    },
    //获取联系电话事件
    GetTelNum(col_code) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "getwardordepttelnum",
            colcode: col_code,
            colvalue: this.PatientInfo[col_code],
          },
        }).then((res) => {
          this.deptwardtelnum = res.msg;
        })
        .catch((e) => {
          console.log(e);
        });
    },
    //申请tab表格双击开窗事件
    reqdbleclick(type) {
      this.dialogreqVisible = true;
      this.dialogreqtype = type;
      var kindno = "0";
      if (type == "1") {
        if (this.Options.modifypurposedbclick == "1" && !this.UpdateJudge()) kindno = "1";
      } else {
        if (this.Options.dbclickmodifyreqitem == "1" && this.PatientInfo.barcode && !this.UpdateJudge()) kindno = "1";
      }
      this.$refs.reqitemdialog.reqdbleclick(type, kindno);
      // if (type == "1") {
      //     if (this.Options.modifypurposedbclick == "1" && !this.UpdateJudge()) {
      //         this.tableDataDialogreqSelect = [];
      //         this.$tool
      //             .request({
      //                 url: "LIS/LIS3/LIS310",
      //                 method: "post",
      //                 data: {
      //                     action: "getrptunitreqitem",
      //                     sampleno: this.specno,
      //                     rptunitid: this.rptunitid
      //                 }
      //             })
      //             .then(res => {
      //                 this.tableDataDialogreqAll = res.data;
      //             });
      //         this.dialogreqVisible = true;
      //     }
      // } else {
      //     if (this.Options.dbclickmodifyreqitem == "1" && this.PatientInfo.barcode && !this.UpdateJudge()) {
      //         this.$tool
      //             .request({
      //                 url: "LIS/LIS3/LIS310",
      //                 method: "post",
      //                 data: {
      //                     action: "popmodifyreqitem",
      //                     barcode: this.PatientInfo.barcode,
      //                     reportid: this.PatientInfo.reportid,
      //                     rptunitid: this.rptunitid
      //                 }
      //             })
      //             .then(res => {
      //                 this.tableDataDialogreqSelect = res.top;
      //                 this.tableDataDialogreqAll = res.bottom;
      //             });
      //         this.dialogreqVisible = true;
      //     }
      // }
    },
    //普通输入框双击展示信息
    ShowDialogMsg(val, label) {
      this.$alert(val, label);
    },
    //输入条码号后检查待检样本明细
    CheckSamples(report) {
      if (this.curtabindex == 11) {
        var row = this.$refs.xTableSmp.tableFullData.find((item) => item.barcode == report.barcode);
        if (row) {
          if (!row.rechkflag || row.rechkflag == "") {
            row.rechkflag = "0";
          }
        }
        if (this.workonmachine == "1") {
          if (row) {
            row.hid = "1";
          }
        } else if (this.workonmachine == "2") {
          if (!row) {
            this.tableDataSmp.unshift({ barcode: report.barcode, pat_name: report.pat_name, pat_agestr: report.pat_agestr, pat_sexname: report.pat_sexname, pat_typecodename: report.pat_typecodename, sample_items: report.req_reason, deptname: report.req_deptnoname, recieve_dt: report.recieve_dt, sample_dt: report.sample_dt, rechkflag: "0" });
            this.tableDataSmpCount++;
          }
        }
      }
    },
    // 设置输入框不可编辑
    ItemEnable(item) {
      var arr = this.Options.bardisablecols.split(",");
      //禁止修改列中包含条码号并且是新加的标本时
      if (arr.indexOf("barcode") > -1 && this.SpecAddflag == 1) {
        //输入无效条码号时不进行禁止修改列操作
        if (this.barcodeinputsuccessflag && this.PatientInfo.barcode && this.PatientInfo.barcode.length > 0 && this.Options.bardisablecols && arr.indexOf(item.col_code) > -1) return true;
        else return !item.enabled;
      } else {
        if (this.PatientInfo.barcode && this.PatientInfo.barcode.length > 0 && this.Options.bardisablecols && arr.indexOf(item.col_code) > -1) return true;
        else return !item.enabled;
      }
    },
    // #endregion 左侧病人信息方法库


    // #region 上侧标本编号、标本日期、报告单元
    // 标本编号格式化
    btKeyUp(e) {
      //this.specno = e.target.value.replace(/[\u4e00-\u9fa5/\s+/]|[,，]/g, "");
      this.specno = e.target.value.replace(/[,，‘’"”“ ]/g, "");
    },
    // 标本号改变
    SpecNoChange() {
      this.specno = this.specno.trim(); //去除前后空格
      return new Promise((s, f) => {
        if (this.execSpecNoChange == 1) {
          // console.log("execSpecNoChange == 1 return");
          return;
        }
        this.execSpecNoChange = 1;
        try {
          // console.log("SpecNoChange");
          // const loading = this.$loading({
          //     lock: true,
          //     text: "读取中",
          //     spinner: "el-icon-loading",
          //     background: "rgba(255, 255, 255, 0.7)",
          // });
          //this.SaveandChangeAction(this.specno);
          this.SaveReportandResult(0, this.selectdate, this.rptunitid).then((r) => {
            //清空一下病人信息和结果，防止有的时候反应慢，切换速度跟不上容易看错
            if (this.Options.switchreportreload == "1") {
              this.InitPatientInfo("changereportinit");
              this.$refs.rmlabresult.tableDataResult = [];
              if (this.Options.doubleresultcol == "1") this.$refs.rmlabresult.tableDataResult1 = [];
              //如果历史结果tab开着，也要清空一下
              if (this.tabvalue == "3") {
                this.HistoryLeftList = [];
                this.HistoryLeftAllList = [];
                this.tableDataHistory = [];
                this.tableDataHistoryMed = [];
              }
            }
            if (this.specnoinputrptunit.length > 0 && this.specno.length == 2) {
              //如果输入的标本编号是报告单元代码，直接切换报告单元
              let rptunit = this.specnoinputrptunit.find((item) => item.rptunitno.toUpperCase() == this.specno.toUpperCase());
              //再来一次判断，省的已经切换到该报告单元了还要再来一次
              if (rptunit && parseInt(rptunit.rptunitid) != this.rptunitid) {
                this.execSpecNoChange = 0;
                this.rptunitid = parseInt(rptunit.rptunitid);
                return;
              }
            }
            //this.SaveandChangeAction(this.specno);
            //提高性能，没必要多次 filter 去查找标本号
            this.$tool
              .request({
                url: "LIS/LIS3/LIS310",
                method: "post",
                data: {
                  action: "getformatsampleno",
                  rptunitid: this.rptunitid,
                  sampledate: this.selectdate,
                  sampleno: this.specno,
                },
              })
              .then((res) => {
                if (!res.hasOwnProperty("errcode")) this.specno = res.rno + "";
                let findrow = this.$refs.xTableList.afterFullData.find((item) => item.sampleno == this.specno && item.sampledate == this.selectdate && item.rptunitid == this.rptunitid);
                if ((this.Options.samplenouniquelen > 0 || this.Options.samplenouniquelen == -1 || this.Options.samplenouniquelen == -2 || this.Options.samplenouniquelen == -3) && this.specno.length > this.Options.samplenouniquelen) {
                  var daterange = this.JudgeSampleDate(this.Options.samplenouniquelen);
                  findrow = this.$refs.xTableList.afterFullData.find((item) => item.sampleno == this.specno && item.sampledate <= daterange.end && item.sampledate >= daterange.start && item.rptunitid == this.rptunitid);
                }
                if (findrow) {
                  this.SetInfoByRow(findrow, this.specno).then(() => {
                    this.ChangeAsTab();
                  }); //通过找到的行数据，赋值页面显示，多处地方用到，提取公共方法
                  this.GetBarcodeHasVal(findrow);
                  this.tempRowIndex = this.tempRowIndex + 1; //选中行序号，不一定就是+1 因为列表中不一定就是按照标本号排序的
                  this.execSpecNoChange = 0;
                  this.AfterRefreshSetActive();
                  s();
                  // if (this.$refs && this.$refs.barcode && this.$refs.barcode[0]) {
                  //     this.$refs.barcode[0].select();
                  // }
                  //this.pageinitloading = false;
                  //开启特殊患者关注项目提醒
                  if (this.Options.specialpatconcernitemalert == "1") {
                    this.queryConcernItem(findrow.reportid);
                  }
                  //获取特殊标记
                  this.Queryreportmark(findrow);
                } else {
                  //新的标本  还有 加载默认值、自动记忆上次值的功能 未完成 TODO
                  this.$pub.Log("开始添加新标本");
                  this.AddNewReport().then(() => {
                    this.execSpecNoChange = 0;
                    this.$pub.Log("添加新标本结束");
                    this.SpecAddflag = 1;
                    this.barcodeinputsuccessflag = false;
                    this.ChangeAsTab();
                    this.AfterRefreshSetActive();
                    s();
                    //this.pageinitloading = false;
                  });
                  this.execSpecNoChange = 0;
                  // if (this.$refs && this.$refs.barcode && this.$refs.barcode[0]) {
                  //     this.$refs.barcode[0].select();
                  // }
                }
              });

            // var rowdata = this.$refs.xTableList.tableFullData.filter((item) => item.sampleno == this.specno && item.sampledate == this.selectdate);
            // if (rowdata.length > 0) {
            //     this.$refs.rmlabresult.QueryResult(rowdata[0]).then((res) => {
            //         if (!res.hasOwnProperty("res")) {
            //             res.res = res;
            //             res.redo = "";
            //             res.history = 0;
            //         }
            //         this.Patredoflag = !!res.redo;
            //         this.PatHistoryNum = res.history;
            //         var row = XE.clone(res.res, true);
            //         this.PatientInfo = this.PatientInfoGetname(row);
            //         this.OldPatientInfo = this.PatientInfoGetname(row);
            //         this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
            //         this.AfterQResult(row.reportid, this);
            //         var listrow = this.$refs.xTableList.tableFullData.filter((item) => item.reportid == row.reportid)[0];
            //         this.$refs.xTableList.setCurrentRow(listrow).then(() => {
            //             this.$refs.xTableList.scrollToRow(listrow);
            //         });
            //         this.ChangeAsTab();
            //         //loading.close();
            //         s();
            //     });
            //     this.$nextTick(() => {
            //         this.tempRowIndex = this.$refs.xTableList.tableFullData.filter((item) => item._XID < this.PatientInfo._XID).length;
            //     });
            //     this.$nextTick(() => {
            //         //console.log(this.ColData);
            //         if (this.$refs && this.$refs.barcode && this.$refs.barcode[0]) {
            //             this.$refs.barcode[0].select();
            //         }

            //         this.ChangeAsTab();
            //         //loading.close();
            //     });
            //     this.execSpecNoChange = 0;
            // } else {
            //     this.InitPatientInfo();
            //     this.$refs.rmlabresult.QueryResult(this.PatientInfo).then((res) => {
            //         if (!res.hasOwnProperty("res")) {
            //             res.res = res;
            //             res.redo = "";
            //             res.history = 0;
            //         }
            //         this.Patredoflag = !!res.redo;
            //         this.PatHistoryNum = res.history;
            //         var row = XE.clone(res.res, true);
            //         this.PatientInfo = this.PatientInfoGetname(row);
            //         this.OldPatientInfo = this.PatientInfoGetname(row);
            //         this.oldbarcode = row.barcode; // 这个待测试，某一个字符串类型的属性赋值也需要深拷贝吗
            //         this.AfterQResult(row.reportid, this);
            //         var listrow = this.$refs.xTableList.tableFullData.filter((item) => item.reportid == row.reportid)[0];
            //         this.$refs.xTableList.setCurrentRow(listrow).then(() => {
            //             this.$refs.xTableList.scrollToRow(listrow);
            //         });
            //         this.ChangeAsTab();
            //         //loading.close();
            //         s();
            //     });
            //     if (this.Options.showreportdays == "1") {
            //         this.selectdate = this.Options.sysdate + " 00:00:00";
            //     }

            //     // this.$refs.rmlabresult.ClearTableDate().then(() => {
            //     //     //loading.close();
            //     //     s();
            //     // });
            //     s();
            //     this.SpecAddflag = 1;
            //     this.$nextTick(() => {
            //         if (this.$refs && this.$refs.barcode && this.$refs.barcode[0]) {
            //             this.$refs.barcode[0].select();
            //         }
            //         this.ChangeAsTab();
            //         //loading.close();
            //     });
            //     this.execSpecNoChange = 0;
            // }
            //this.$refs[this.ColData[0].valuetype == "5" ? this.ColData[0].col_code + "name" : this.ColData[0].col_code][0].select();
            // })
            // .catch(() => {
            //     //loading.close();
            //     f();
            //     this.execSpecNoChange = 0;
          });
        } catch (e) {
          //loading.close();
          f();
          this.execSpecNoChange = 0;
        }
      });
    },
    // 背景色调整
    DateBackGround() {
      var datenow = this.sysdate + " 00:00:00";
      if (datenow > this.selectdate) {
        return "beforedate";
      } else if (datenow < this.selectdate) {
        return "overdate";
      } else {
        return "basecolor";
      }
    },
    // 标本日期改变
    selectdateChange(val) {
      if (this.olddate != val) {
        this.SaveReportandResult(1, this.selectdate, this.rptunitid)
          .then(() => {
            this.tabvalue = "1";
            this.QueryList(2);
            //重置日期提醒标志
            this.nottodayalertflag = true;
          })
          .catch((dataf) => {
            console.log("error");
            this.selectdate = XE.clone(this.olddate, true);
          });
      } else {
      }
    },
    // #endregion 上侧标本编号、标本日期、报告单元


    // #region 无用方法库(未使用)
    ApplyChange({ row }) {
      this.QueryApplyItem(row.req_itemcode);
    },
    ResultMove(row, type, index, coltype) {
      if (type == 1) {
        if (index < this.$refs.rmlabresult.$refs.xTableResult.tableFullData.length - 1) {
          var row = this.$refs.rmlabresult.$refs.xTableResult.tableFullData[index + 1];
          this.$refs.rmlabresult.$refs.xTableResult.setCurrentRow(row);
          if (this.PRGNO == "LIS311") this.$refs.rmlabresult.QueryMed(row.rpt_itemcode);
          if (coltype == "rpt_itemname") {
            this.$refs.rmlabresult.$refs.xTableResult.setActiveCell(row, "rpt_itemname");
          } else {
            this.$refs.rmlabresult.$refs.xTableResult.setActiveCell(row, "result_str");
          }
        }
      } else {
        if (index != 0) {
          var row = this.$refs.rmlabresult.$refs.xTableResult.tableFullData[index - 1];
          this.$refs.rmlabresult.$refs.xTableResult.setCurrentRow(row);
          if (this.PRGNO == "LIS311") this.$refs.rmlabresult.QueryMed(row.rpt_itemcode);
          if (coltype == "rpt_itemname") {
            this.$refs.rmlabresult.$refs.xTableResult.setActiveCell(row, "rpt_itemname");
          } else {
            this.$refs.rmlabresult.$refs.xTableResult.setActiveCell(row, "result_str");
          }
        }
      }
    },
    Queryreportinfo() {
      return new Promise((s, f) => {
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            data: {
              action: "getreportinfo",
              rptunitid: this.rptunitid,
              sampledate: this.selectdate,
              sampleno: this.specno,
            },
          })
          .then((res) => {
            if (!res.hasOwnProperty("errcode")) {
              this.PatientInfo = XE.clone(res, true);
              this.OldPatientInfo = XE.clone(res, true);
              this.oldbarcode = this.OldPatientInfo.barcode;
              this.$pub.Log("queryreportinfo完成then");
              s();
            } else {
              this.$pub.Log("queryreportinfo完成catch");
              f();
            }
          });
      });
    },
    DealApplyData(res) {
      this.tableDataApplyUp = res.Data;
      this.tableColumnApplyUp = res.Cols;
      this.reqitemlist = "";
      this.reqamount = 0;
      this.reqnum = res.Data.length;
      if (res.Data.length > 0) {
        for (let i = 0; i < res.Data.length; i++) {
          if (i < res.Data.length - 1) this.reqitemlist += res.Data[i].req_itemname + ",";
          else this.reqitemlist += res.Data[i].req_itemname;
          let loopamount = 0;
          if (res.Data[i].amount && res.Data[i].amount != "") loopamount = parseFloat(res.Data[i].amount);
          this.reqamount = parseFloat(this.reqamount) + loopamount;
        }
      }
    },
    //分单类别切换过滤待检样本      去除分单类别过滤待检样本
    // CurrentSmpChange({ row }) {
    //     this.tableDataSmp = this.tableDataSmpAll.filter(item => item.req_groupid == row.req_groupid);
    // },
    // OpenDetail() {
    //     this.DetailVisible = true;
    // },
    ResetSeqno(data) {
      for (let i = 0; i < data.length; i++) {
        data[i].seqno = (i + 1) * 10;
      }
      return data;
    },
    //药敏提醒
    async MedRemind(meds, type, delmeds) {
      try {
        if (this.Options.modifyresultmsg == "1" && type != "2") {
          var msgs = [];
          let h = this.$createElement;
          if (meds && meds.length > 0) {
            var uplist = meds.filter((item) => item.updateflag == 2);//更新的数据
            var inslist = meds.filter((item) => item.updateflag == 1);//新增的数据
            var resultlist = this.$refs.rmlabresult.$refs.xTableResult.tableFullData;//检验项目数据

            if (uplist.length > 0) {
              msgs.push(h('p', null, "当前报告有药敏结果发生改动，是否保存?"));
              var isdif = false;
              uplist.forEach(e => {
                var resultitem = resultlist.find((item) => item.rpt_itemcode == e.rpt_itemcode);
                var tipmsg = "";
                if (resultitem) {
                  tipmsg += "检验项目:" + resultitem.rpt_itemname + ";";
                  if (e.medname != e.oldmedname) {
                    tipmsg += "抗生素:" + e.oldmedname + " --> " + e.medname + ";";
                    isdif = true;
                  } else {
                    tipmsg += "抗生素:" + e.medname + ";";
                  }
                  if (e.oldrad != e.rad) {
                    tipmsg += "Rad:" + e.oldrad + " --> " + e.rad + ";";
                    isdif = true;
                  }
                  if (e.oldmic != e.mic) {
                    tipmsg += "Mic:" + e.oldmic + " --> " + e.mic + ";";
                    isdif = true;
                  }
                  if (e.oldmedresult != e.medresult) {
                    tipmsg += "药敏结果:" + e.oldmedresult + " --> " + e.medresult + ";";
                    isdif = true;
                  }
                  if (isdif) {
                    msgs.push(h('p', null, tipmsg));
                  }
                }
              });
              if (!isdif) msgs = [];
              console.log("uplist msgs", msgs);
            }

            if (inslist.length > 0) {
              if (msgs.length == 0) {
                msgs.push(h('p', null, "当前报告有药敏结果发生改动，是否保存?"));
              }
              inslist.forEach(e => {
                var resultitem = resultlist.find((item) => item.rpt_itemcode == e.rpt_itemcode);
                var tipmsg = "";
                if (resultitem) {
                  tipmsg += "检验项目:" + resultitem.rpt_itemname + ";";
                  tipmsg += "新增抗生素: " + e.medname + ";Rad: " + e.rad + ";Mic: " + e.mic + ";药敏结果: " + e.medresult + ";";
                  msgs.push(h('p', null, tipmsg));
                }
              })
              console.log("inslist msgs", msgs);
            }
          }
          if (delmeds && delmeds.length > 0) {
            if (msgs.length == 0) {
              msgs.push(h('p', null, "当前报告有药敏结果发生改动，是否保存?"));
            }
            delmeds.forEach(e => {
              var resultitem = resultlist.find((item) => item.rpt_itemcode == e.rpt_itemcode);
              var tipmsg = ""
              if (resultitem) {
                tipmsg += "检验项目:" + resultitem.rpt_itemname + ";";
                tipmsg += "删除抗生素: " + e.medname + ";Rad: " + e.rad + ";Mic: " + e.mic + ";药敏结果: " + e.medresult + ";";
                msgs.push(h('p', null, tipmsg));
              }
            })
          }
          if (msgs && msgs.length > 0) {
            let focuscancel = false;
            if (this.Options.modifyresultmsgdefyes == "2" || this.Options.modifyresultmsgdefyes == "4") {
              focuscancel = true;
            }

            await this.$confirm("提示", {
              title: "提示",
              message: h('div', null, msgs),
              confirmButtonText: "确定", cancelButtonText: "取消",
              focusCancelButton: focuscancel,
              type: "warning",
            });
            if (this.Options.modifyresultmsgdefyes == "4") {
              await this.$confirm("提示", {
                title: "提示",
                message: h('div', null, msgs),
                confirmButtonText: "确定", cancelButtonText: "取消",
                focusCancelButton: focuscancel,
                type: "warning",
              });
            }
          }
        }
      } catch (ex) {
        this.$refs.rmlabresult.$refs.xTableResult.revert();//检验项目还原更新
        if (this.$refs.rmlabresult.$refs.xTableResult1) {
          this.$refs.rmlabresult.$refs.xTableResult1.revert();
        }
        this.$refs.rmlabresult.$refs.xTableMed.revert();//药敏还原更新
        this.$refs.rmlabresult.MedTotalData = [];//清空药敏
        this.$refs.rmlabresult.DelMedTotalData = [];//清空删除的药敏
        console.log("ex", ex);
        //console.log("第一个带药敏的检验项目code",this.$refs.rmlabresult.showmedrptitemcode);
        //console.log("取消之后的检验数据",this.$refs.rmlabresult.$refs.xTableResult.tableFullData);
        //console.log("取消之后的药敏数据",this.$refs.rmlabresult.$refs.xTableMed.tableFullData);
        var fulldata = this.$refs.rmlabresult.$refs.xTableResult.tableFullData;

        if (fulldata && fulldata.length > 0) {
          var currentrow = this.$refs.rmlabresult.$refs.xTableResult.getData(0);
          if (this.$refs.rmlabresult.showmedrptitemcode) {
            currentrow = fulldata.find((item) => item.rpt_itemcode == this.$refs.rmlabresult.showmedrptitemcode);
          }
          //console.log("当前选中行currentrow",currentrow)
          this.$refs.rmlabresult.$refs.xTableResult.setCurrentRow(currentrow);

          this.$refs.rmlabresult.QueryMed(currentrow, currentrow.rpt_itemcode, currentrow.reportid, "1");
        }
        this.changekeyflag = false;
        throw new Error('cancel');
      }
    },
    //后台调用计算参考值
    CalcRef(row) {
      this.$tool
        .request({
          url: "LIS/LIS3/LIS310",
          method: "post",
          data: {
            action: "calcref",
            sex: this.PatientInfo.pat_sex ? this.PatientInfo.pat_sex : this.PatientInfo.pat_sexname,
            ageyear: this.PatientInfo.pat_ageyear,
            agestr: this.PatientInfo.pat_birth ? this.PatientInfo.pat_birth : this.PatientInfo.pat_agestr,
            specimen: this.PatientInfo.specimen_code,
            physicycle: this.PatientInfo.physicycle,
            deptno: this.PatientInfo.req_deptno,
            diagicd: this.PatientInfo.pat_diag_icd,
            hospcode: this.PatientInfo.hospcode,
            resultrow: row,
          },
        })
        .then((res) => {
          for (var item in res) {
            row[item] = res[item];
          }
        })
        .catch((error) => {
          this.$message.error("错误:" + error);
        });
    },
    //切换后加载tab页
    TabChangeAfterSave(tabindex, tabdata) {
      switch (tabindex) {
        case 2:
          this.DealImageData(tabdata);
          break;
        case 3:
          this.QueryHistory();
          break;
        case 4:
          this.DealInputMdl(tabdata);
          break;
        case 5:
          this.QueryApply();
          this.QueryApplyItem();
          break;
        case 6:
          this.DealRechkData(tabdata);
        case 7:
          this.DealCommuite(tabdata);
      }
    },
    RightCopy(e, item) {
      var that = this;
      this.$contextmenu({
        items: [
          {
            label: "复制",
            onClick: () => {
              if (item.valuetype != "5") {
                that.copystr = that.PatientInfo[item.col_code];
                that.copytype = "";
              } else {
                that.copystr = that.PatientInfo[item.col_code + "name"];
                that.copycode = that.PatientInfo[item.col_code];
                that.copytype = item.col_code;
              }
            },
          },
          {
            label: "粘贴",
            onClick: () => {
              if (item.valuetype != "5") {
                that.PatientInfo[item.col_code] = that.copystr;
              } else {
                if (item.col_code != "rechk_user") {
                  that.PatientInfo[item.col_code + "name"] = that.copystr;
                  if (item.col_code == that.copytype) that.PatientInfo[item.col_code] = that.copycode;
                }
              }
            },
          },
        ],
        event,
        // x: e.clientX + 20,
        // y: e.clientY,
        customClass: "RightBack",
        zIndex: 2999,
        minWidth: 230,
      });
    },
    //判断条码号
    PatnoChangebarcode() {
      if (this.PatientInfo.barcode) {
        //检查是不是开窗录入
      }
    },
    //刷新后根据选项选择停留行
    SettheRefreshRow(tempspecno) {
      if (!tempspecno) tempspecno = "1";
      switch (this.Options.automaxsampleno) {
        case "1":
          this.specno = this.$refs.xTableList.tableFullData[this.$refs.xTableList.tableFullData.length - 1].sampleno;
          this.SpecNoChange();
          break;
        case "2":
          this.specno = tempspecno;
          this.SpecNoChange();
          break;
        case "3":
          this.specno = this.$refs.xTableList.tableFullData[this.$refs.xTableList.tableFullData.length - 1].sampleno;
          this.SpecNoChange();
          break;
        default:
          this.specno = this.$refs.xTableList.tableFullData[0].sampleno;
          this.SpecNoChange();
          break;
      }
    },
    SaveCaSign(ret, reportid, rechkuser) {
      return new Promise((s, f) => {
        this.$tool
          .request({
            url: "LIS/LIS3/LIS310",
            method: "post",
            data: {
              action: "savecasign",
              signdata: ret.signdata,
              reportid: reportid,
              rechkuser: rechkuser,
            },
          })
          .then((res) => {
            if (res.flag == "1") {
              s();
            } else {
              this.$alert("CA[电子签名]认证或记录失败，您可以稍后手工补电子签名，或解除审核后重新审核！" + res.msg, "CA签名失败！")
                .then(() => {
                  s();
                })
                .catch(() => {
                  s();
                });
            }
          })
          .catch((e) => {
            this.$alert("CA[电子签名]认证或记录失败，您可以稍后手工补电子签名，或解除审核后重新审核", "CA签名失败！")
              .then(() => {
                s();
              })
              .catch(() => {
                s();
              });
          });
      });
    },
    // msgsubmitjudge(val) {
    //     var judge = true;
    //     for (let i = 0; i < this.InputMsg.length; i++) {
    //         judge = judge && !!this.InputMsg[i].msg;
    //     }
    //     this.Submitdisabled = !judge;
    //     if (this.msglist[0].hasOwnProperty("errflag")) this.Submitdisabled = true;
    // },
    AddImage() {
      if (!this.PatientInfo.reportid) {
        this.$alert("请先保存报告数据，再选择图片！");
        return;
      }
      this.$refs.imgupload.$refs["upload-inner"].$refs.input.dispatchEvent(new MouseEvent("click"));
      //this.$refs.imgupload.dispatchEvent(new MouseEvent("click"));
    },
    fileLoad(file) {
      var name = file.name; //选中文件的文件名
      var size = file.size; //选中文件的大小

      var reader = new FileReader();
      var AllowImgFileSize = 2100000; //上传图片最大值(单位字节)（ 2 M = 2097152 B ）超过2M上传失败
      var imgUrlBase64;
      var _this = this;
      if (file) {
        //将文件以Data URL形式读入页面
        imgUrlBase64 = reader.readAsDataURL(file.raw);

        reader.onload = function (e) {
          //var ImgFileSize = reader.result.substring(reader.result.indexOf(",") + 1).length;//截取base64码部分（可选可不选，需要与后台沟通）
          if (AllowImgFileSize != 0 && AllowImgFileSize < reader.result.length) {
            _this.$alert("只能上传不超过2M的图片", "错误", {
              confirmButtonText: "确定",
            });
            return;
          } else {
            //执行上传操作
            _this.ImageUpload(reader.result);
          }
        };
      }
    },
    handlePreview(file) {
      this.selectimage = file.url;
      this.selectseq = file.seq;
      this.selectname = file.name;
      this.imagecomm = file.comm;
    },
    handleRemove(file) {
      this.DelImage(file.seq, file.graphitemno);
    },
    handleProgress(event, file, fileList) {
      this.fileLoad(file);
    },
    //申请tab双击弹窗双击事件
    cellDBLClickEvent({ row, rowIndex }, e) {
      if (this.dialogreqtype == "1") {
        if (e == "1") {
          this.tableDataDialogreqSelect = this.tableDataDialogreqSelect.filter((item) => item.req_itemcode != row.req_itemcode);
        } else {
          if (this.tableDataDialogreqSelect.filter((item) => item.req_itemcode == row.req_itemcode).length == 0) {
            this.tableDataDialogreqSelect.push(row);
          }
        }
      } else {
        if (e == "1" && row.lab_add) {
          this.$refs.xtablereqtop.remove(row);
        } else {
          if (!this.$refs.xtablereqtop.tableFullData.find((item) => item.req_itemcode == row.req_itemcode)) {
            row.lab_add = "1";
            this.$refs.xtablereqtop.insertAt(row, -1);
          }
        }
      }
    },
    // 批次打印
    Batchprint() {
      let rows = this.$refs.BatRechkTable.getSelectRecords();
      let uncheckreportids = "";
      for (let index = 0; index < rows.length; index++) {
        const element = rows[index];
        if (element.cp_msg == "审核成功") {
          this.singleprint(element.reportid);
        }
        else {
          uncheckreportids += element.reportid + ",";
        }
      }
      if (uncheckreportids != "") {
        this.$message.error("以下报告：" + uncheckreportids.trimEnd(',') + "未审核，不能进行打印!");
      }

    },
    //合并当前病人结果
    MergeNowPat() {
      if (this.PatientInfo.barcode && this.PatientInfo.pat_no) {
        this.dialogpatmergerptVisible = true;
      } else {
        this.$alert("当前病人没有条码和病人号信息，无法合并!", "提示");
      }
    },
    // #endregion 无用方法库(未使用)

  },
  watch: {
    // #region 监视值
    reagestrch(val) {
      this.reagestren = val.replace("岁", "y").replace("月", "m").replace("日", "d").replace("小时", "h").replace("分钟", "f");
    },
    PatientInfo(val, old) {
      //nowatchflag为false或者undefined才能监视
      if (!val.nowatchflag) {
        if (this.PatHistoryNum > 0) this.HistoryTitle = "历史结果 " + this.PatHistoryNum;
        else this.HistoryTitle = "历史结果";

        if (!val.reportid) {
          this.HistoryTitle = "历史结果";
          this.PatHistoryNum = 0;
          this.Patredoflag = false;
        }
        //del by yangliang 2021-10-12 检验者为空的话，前台也不用右下角的检验者来赋值了 免得分不清到底数据库里面是不是空，
        //并且如果赋值的话，点保存时还会把这个检验者存到数据库，后台分不清是通过设置字段默认值来的还是右下角的全局检验者
        // if (!val.report_username) {
        //     val.report_user = this.exactusernoreport;
        //     val.report_username = this.exactusernamereport;
        // }

        if (this.PatHistoryNum > 0 && this.tabvalue == 3) this.tabvalue = "TabColorH";
        if (this.PatHistoryNum == 0 && this.tabvalue == "TabColorH") this.tabvalue = "3";
        if (this.Patredoflag && this.tabvalue == 6) this.tabvalue = "TabColorR";
        if (!this.Patredoflag && this.tabvalue == "TabColorR") this.tabvalue = "6";
        //del by yangliang 2021-05-13 审核者前台不进行修改
        // if (!val.rechk_username) {
        //     val.rechk_user = this.exactusernorhk;
        //     val.rechk_username = this.exactusernamerhk;
        // }
        if (this.Options.checkmustsignname == "1" && val.rechkflag == "0") {
          this.$emit("title", "签名");
          this.chktitleflag = true;
        } else {
          this.$emit("title", "审核");
          this.chktitleflag = false;
        }
        if (val.rechkflag == "9" || val.rechkflag == "1" || (this.Options.onlymodifymyreport == "1" && this.$tool.getSession(this.$tool.loginuserno) != val.report_user) || (this.PatientInfo.barcode && this.PatientInfo.barcode.indexOf("-退") > -1)) {
          this.$emit("haschange", true);
          this.$refs.rmlabresult.editflag = false;
          if (val.rechkflag == "1" && this.Options.canupdateaftersign == "1") {
            this.$emit("haschange", false);
            this.$refs.rmlabresult.editflag = true;
          }
          if (!this.Begincheckmode) {
            if (val.rechkflag == "9" && val.autocheckflag && val.autocheckflag == "1") this.imgUrl = require("@/assets/img/checkedauto.png");
            else if (val.rechkflag == "9") this.imgUrl = require("@/assets/img/checked.png");
            else if (val.barcode.indexOf("-退") > -1) this.imgUrl = require("@/assets/img/reject.png");
            else if (val.rechkflag == "1" && val.autosignflag && val.autosignflag == "1") this.imgUrl = require("@/assets/img/signedauto.png");
            else this.imgUrl = require("@/assets/img/signed.png");
          } else {
            this.imgUrl = "";
          }
          // this.btnchilddisabled = true;
        } else {
          this.$emit("haschange", false);
          this.imgUrl = "";
          this.$refs.rmlabresult.editflag = true;
          // this.btnchilddisabled = false;
        }
        var findright = this.RightItem.find((item) => item.field == "btnEnOrDecry");
        var findmore = this.RightItem.find((item) => item.field == "More...");
        if (!findright && findmore) {
          findright = findmore.children.find((item) => item.field == "btnEnOrDecry");
        }
        if (val.encrypt_flag == "1" && findright) {
          findright.label = "信息解密";
        } else if (findright) {
          findright.label = "信息加密";
        }
        this.OldPatientInfo = XE.clone(val, true);
        this.PatientInfoDefVal(val);

        if (this.myreport || this.mygreport || !!this.rptunitgroup)
          //if (this.selectdate != val.sampledate && val.sampledate) this.selectdate = val.sampledate;
          this.rptunitid = val.rptunitid;
      }
    },
    rechktextvalueshow(val) {
      if (val) {
        this.iconclass = "el-icon-arrow-up";
      } else {
        this.iconclass = "el-icon-arrow-down";
      }
    },
    OldPatientInfo(val) {
      //del by yangliang 2021-10-12 检验者为空的话，前台也不用右下角的检验者来赋值了
      // if (!val.report_username) {
      //     val.report_user = this.exactusernoreport;
      //     val.report_username = this.exactusernamereport;
      // }
      //del by yangliang 2021-05-13 审核者前台不进行修改
      // if (!val.rechk_username) {
      //     val.rechk_user = this.exactusernorhk;
      //     val.rechk_username = this.exactusernamerhk;
      // }
    },
    selectdate(val, old) {
      this.olddate = old;
    },
    myreport(val) {
      if (val) {
        this.pagebylist = true;
        this.rptunitgroup = "";
        if (this.myunitreport) this.myunitreport = false;
        //选择我的报告时要记住原始报告单元
        if (this.lis310multiple == "1") {
          this.$tool.setTitle("报告: 我的报告(所有)");
          var pageinfo = this.$tool.getSession("RptPageInfo");
          if (pageinfo) {
            var pagearr = JSON.parse(pageinfo);
            if (pagearr && pagearr.length > 0) {
              var oneobj = pagearr.find((item) => item.id == this.$route.query.id);
              if (oneobj) {
                //这里要防止我的报告本组报告都选择导致原始报告单元被覆盖
                if (!oneobj.initrptunitid) {
                  oneobj.initrptunitid = this.rptunitid;
                }
              } else {
                pagearr.push({ id: this.$route.query.id, rptunitid: now, path: this.$route.fullPath, multi: "", initrptunitid: this.rptunitid });
              }
            }
          }
          this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
        }
      } else {
        if (this.mygreport) {
          this.$tool.setTitle("报告: 本组报告");
          return;
        }
        if (this.lis310multiple == "1") {
          var pageinfo = this.$tool.getSession("RptPageInfo");
          console.log(pageinfo);
          var pagearr = [];
          if (pageinfo) {
            pagearr = JSON.parse(pageinfo);
          }
          var pageobj = pagearr.find((item) => item.id == this.$route.query.id);
          if (pageobj) {
            //取消我的报告后返回原始报告单元
            this.rptunitid = pageobj.initrptunitid;
            this.$tool.setTitle((this.myunitreport ? "我的报告:" : "报告:") + this.Options.rptunit.rptunitname, pageobj.path);
          }
          else this.$tool.setTitle((this.myunitreport ? "我的报告:" : "报告:") + this.Options.rptunit.rptunitname);
        }
      }
    },
    mygreport(val) {
      if (val) {
        this.pagebylist = true;
        this.rptunitgroup = "";
        if (this.myunitreport) this.myunitreport = false;
        //选择本组报告时要记住原始报告单元
        if (this.lis310multiple == "1") {
          this.$tool.setTitle("报告: 本组报告");
          var pageinfo = this.$tool.getSession("RptPageInfo");
          if (pageinfo) {
            var pagearr = JSON.parse(pageinfo);
            if (pagearr && pagearr.length > 0) {
              var oneobj = pagearr.find((item) => item.id == this.$route.query.id);
              if (oneobj) {
                //这里要防止我的报告本组报告都选择导致原始报告单元被覆盖
                if (!oneobj.initrptunitid) {
                  oneobj.initrptunitid = this.rptunitid;
                }
              } else {
                pagearr.push({ id: this.$route.query.id, rptunitid: now, path: this.$route.fullPath, multi: "", initrptunitid: this.rptunitid });
              }
            }
          }
          this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
        }
      } else {
        if (this.myreport) {
          this.$tool.setTitle("报告: 我的报告(所有)");
          return;
        }
        if (this.lis310multiple == "1") {
          var pageinfo = this.$tool.getSession("RptPageInfo");
          console.log(pageinfo);
          var pagearr = [];
          if (pageinfo) {
            pagearr = JSON.parse(pageinfo);
          }
          var pageobj = pagearr.find((item) => item.id == this.$route.query.id);
          if (pageobj) {
            //取消本组报告后返回原始报告单元
            this.rptunitid = pageobj.initrptunitid;
            this.$tool.setTitle((this.myunitreport ? "我的报告:" : "报告:") + this.Options.rptunit.rptunitname, pageobj.path);
          }
          else this.$tool.setTitle((this.myunitreport ? "我的报告:" : "报告:") + this.Options.rptunit.rptunitname);
        }
      }
    },
    myunitreport(val) {
      if (val) {
        //当勾选"我的报告(当前单元)"的时候，只会显示自己本单元的报告，所以"我的报告(所有)"和"本组报告"自动取消勾选
        this.myreport = false;
        this.mygreport = false;
        this.rptunitgroup = "";
        this.$tool.setTitle("我的报告:" + this.Options.rptunit.rptunitname);
      } else {
        if (this.myreport) {
          this.$tool.setTitle("报告: 我的报告(所有)");
          return;
        }
        if (this.mygreport) {
          this.$tool.setTitle("报告: 本组报告");
          return;
        }
        this.$tool.setTitle("报告:" + this.Options.rptunit.rptunitname);
      }
    },
    rptunitgroup(val) {
      if (val) {
        this.pagebylist = true;
        //当选择"单元组合"的时候，只显示当前选择的单元组合内的所有报告单元，所以"我的报告(当前单元)"、"我的报告(所有)"和"本组报告"自动取消勾选
        this.myreport = false;
        this.mygreport = false;
        this.myunitreport = false;
        //选择单元组合时要记住原始报告单元
        if (this.lis310multiple == "1") {
          var filter = this.rptunitgroupfilter.find(item => item.rptunitgroupid == val);
          if (filter) this.$tool.setTitle("报告: " + filter.rptunitgroupname);
          var pageinfo = this.$tool.getSession("RptPageInfo");
          console.log(pageinfo);
          if (pageinfo) {
            var pagearr = JSON.parse(pageinfo);
            if (pagearr && pagearr.length > 0) {
              var oneobj = pagearr.find((item) => item.id == this.$route.query.id);
              if (oneobj) {
                //这里要防止原始报告单元被覆盖
                if (!oneobj.initrptunitid) {
                  oneobj.initrptunitid = this.rptunitid;
                }
              } else {
                pagearr.push({ id: this.$route.query.id, rptunitid: now, path: this.$route.fullPath, multi: "", initrptunitid: this.rptunitid });
              }
            }
          }
          this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
        }
      } else {
        if (this.lis310multiple == "1") {
          var pageinfo = this.$tool.getSession("RptPageInfo");
          console.log(pageinfo);
          var pagearr = [];
          if (pageinfo) {
            pagearr = JSON.parse(pageinfo);
          }
          var pageobj = pagearr.find((item) => item.id == this.$route.query.id);
          if (pageobj) {
            //取消选择后返回原始报告单元
            this.rptunitid = pageobj.initrptunitid;
          }
        }
      }
    },
    rptunitid(now, old) {
      if (this.pageinitloading) return;
      // 找下是否有权限访问该报告单元，没有权限直接返回
      if (this.rolerptunitlist.length > 0) {
        let rolerptunit = this.rolerptunitlist.find((item) => item.rptunitid == now);
        if (!rolerptunit) {
          //无论是点确定还是直接叉掉都要返回原来的报告单元
          this.$alert("您没有权限访问该报告单元，请联系管理员添加！").then((r) => { this.rptunitid = old; })
            .catch((e) => { this.rptunitid = old; });
          return;
        }
      }
      if (this.myreport || this.mygreport || !!this.rptunitgroup) {
        //this.ListKey = "ListTable_" + now;
        this.$refs.xTableList.refreshColumn();
        this.oldrptunitid = now;
        this.GetOptions(now).then((p) => {
          //我的报告和本组报告切换报告时报告单元切换也要更新RptPageInfo，防止后面未打开的报告单元无法打开
          if (this.lis310multiple == "1") {
            var pageinfo = this.$tool.getSession("RptPageInfo");
            if (pageinfo) {
              var pagearr = JSON.parse(pageinfo);
              if (pagearr && pagearr.length > 0) {
                var oneobj = pagearr.find((item) => item.id == this.$route.query.id);
                if (oneobj) {
                  oneobj.rptunitid = now;
                } else {
                  pagearr.push({ id: this.$route.query.id, rptunitid: now, path: this.$route.fullPath, multi: "" });
                }
              }
            }
            this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
          }
          this.QueryCol();
        });
        return;
      }
      if (this.oldrptunitid != now) {
        this.SaveReportandResult(1, this.selectdate, old)
          .then((r) => {
            this.oldrptunitid = now;
            // this.$refs.rmlabresult.ResultTableKey = "";
            // this.$refs.rmlabresult.ResultTableKey = "ResultTable";
            //this.ListKey = "ListTable_" + now;
            //this.ListKey = this.PRGNO + "_ListTable_" + now;
            //this.rpttableid = now + "";
            //this.$refs.xTableList.refreshColumn();
            this.GetOptions(now).then((p) => {
              // var tabindex = this.Tablist.indexOf(this.tabvalue);
              // if (tabindex <= -1) this.tabvalue = "1";
              if (this.lis310multiple == "1") {
                var pageinfo = this.$tool.getSession("RptPageInfo");
                if (pageinfo) {
                  var pagearr = JSON.parse(pageinfo);
                  if (pagearr && pagearr.length > 0) {
                    var oneobj = pagearr.find((item) => item.id == this.$route.query.id);
                    if (oneobj) {
                      oneobj.rptunitid = now;
                      oneobj.initrptunitid = "";//我的报告本组报告已经取消选择，那么初始报告单元也置空
                    } else {
                      pagearr.push({ id: this.$route.query.id, rptunitid: now, path: this.$route.fullPath, multi: "" });
                    }
                  }
                }
                this.$tool.setSession("RptPageInfo", JSON.stringify(pagearr));
              }
              this.tabvalue = "1";
              this.QueryCol().then(() => {
                this.QueryList(1);
              });
            });
          })
          .catch((fau) => {
            this.rptunitid = old;
            this.QueryCol().then(() => {
              this.QueryList(1);
            });
          });
      } else {
      }
      this.ChangeAsTab();
      this.InputCodeArr = [];
    },
    checkingflag(val) {
      if (!val) {
        if (this.CheckingMsgObj) {
          this.CheckingMsgObj.close();
          this.CheckingMsgObj = "";
        }
      }
    },
    filtervisible(val) {
      if (!val) {
        this.ListSearchFilter = { Checkflag: "全部", Printflag: "全部", Emerflag: "全部", Rechkflag: "全部", Completeflag: "全部", Chargeflag: "全部", Custom: "", Markflag: "全部", OverTimeflag: "全部", Signflag: "全部", Nucleinflag: "全部", Exceptionflag: "全部" };
        this.ListSearchOtherflag = "全部";
        this.ListSearchpattype = "全部";
      }
    },
    filtervisibleSmp(val) {
      if (!val) {
        this.SmpSearchFilter = { Stasusflag: ["已签收", "已采样", "已生成", "住院", "门诊", "其他"] };
      }
    },
    exactusernamereport(val) {
      this.$tool.statusbarMsg(3, '<span style="color:red;">检验者: ' + val + '</span><span style="color:red;margin-left:5px">审核者: ' + (!this.Options.replacechkuserno || !this.Options.replacechkusername ? this.exactusernamerhk : this.Options.replacechkusername + '(' + this.exactusernamerhk + ')') + "</span>");
    },
    exactusernamerhk(val) {
      this.$tool.statusbarMsg(3, '<span style="color:red;">检验者: ' + this.exactusernamereport + '</span><span style="color:red;margin-left:5px">审核者: ' + (!this.Options.replacechkuserno || !this.Options.replacechkusername || !val ? val : this.Options.replacechkusername + '(' + val + ')') + "</span>");
    },

    "Options.replacechkuserno": {
      handler(val) {
        this.$tool.statusbarMsg(3, '<span style="color:red;">检验者: ' + this.exactusernamereport + '</span><span style="color:red;margin-left:5px">审核者: ' + (!this.Options.replacechkuserno || !this.Options.replacechkusername || !this.exactusernamerhk ? this.exactusernamerhk : this.Options.replacechkusername + '(' + this.exactusernamerhk + ')') + "</span>");
      },
      deep: true,
    },

    "PatientInfo.emer_flag": {
      handler(newName, oldName) {
        console.log("new", newName);
        if (newName == "1") {
          if (this.$refs.pat_name && this.$refs.pat_name[0]) {
            this.$refs.pat_name[0].$refs.input.style.color = "red";
          }
          if (this.$refs.pat_sex && this.$refs.pat_sex[0]) {
            this.$refs.pat_sex[0].$refs.input.style.color = "red";
          }
        } else {
          if (this.$refs.pat_name && this.$refs.pat_name[0]) {
            this.$refs.pat_name[0].$refs.input.style.color = "";
          }
          if (this.$refs.pat_sex && this.$refs.pat_sex[0]) {
            this.$refs.pat_sex[0].$refs.input.style.color = "";
          }
          //this.$refs.emer_flag[0].$el.style.color = "";
        }
      },
      deep: true,
    },
    deep: true,
    // #endregion 监视值
  },
};
</script>

<style scoped>::v-deep .el-message-box {
  width: 700px;
}

::v-deep .rptunitdllclass .el-input--small .el-input__inner {
  font-size: 14px;
  font-weight: bold;
}

::v-deep .sampledateclass .el-input__inner {
  font-size: 14px;
  font-weight: bold;
  padding-right: 0px;
}

::v-deep .upload-img .el-upload--text {
  border: none !important;
  border-radius: 3px !important;
  overflow: inherit !important;
}

::v-deep .disabled-cell {
  background-color: #ccc;
}

::v-deep .warn-high {
  background-color: #ffc0c0;
}

::v-deep .warn-low {
  background-color: #c0c0ff;
}

::v-deep .danger {
  background-color: #ff0000;
}

::v-deep .fail {
  color: #ff0000;
}

::v-deep .RechkBack {
  background-color: var(--previewbackcolor) !important;
}

::v-deep .SignBack {
  background-color: #d3bde2 !important;
}

::v-deep .PendingPreview {
  background-color: var(--pendingbackcolor) !important;
}

::v-deep .printrpt {
  background-color: var(--printbackcolor) !important;
}

::v-deep .OverTime {
  background-color: var(--overtimecolor) !important;
}

::v-deep .hasworked {
  background-color: #e6e6e6 !important;
}

::v-deep .overdate {
  background-color: #80ff80 !important;
}

::v-deep .beforedate {
  background-color: #ffff80 !important;
}

::v-deep .basecolor {
  background-color: var(--basecolor) !important;
}

::v-deep .el-image {
  z-index: 2005;
}

::v-deep .vxe-body--row .el-input--small .el-input__inner {
  height: 20px !important;
  line-height: 20px !important;
}

::v-deep .smpsomecheck .el-input__inner {
  height: 18px !important;
  line-height: 18px !important;
}

::v-deep .middle-left .el-checkbox__input.is-checked+.el-checkbox__label {
  color: red;
}

::v-deep .dialogdanger .el-textarea.is-disabled .el-textarea__inner {
  color: red;
}

::v-deep .el-message-box__wrapper.msgboxtop {
  z-index: 9999;
}

::v-deep .el-upload-list--picture-card .el-upload-list__item {
  width: 100px;
  height: 80px;
}

::v-deep .el-upload--picture-card {
  width: 100px;
  height: 80px;
}

::v-deep .el-input.is-disabled .el-input__inner {
  color: #606266;
}

::v-deep .checkmodeclass .el-textarea__inner {
  padding: 5px 5px;
}

.menu_style {
  position: absolute;
  width: 150px;
  background-color: #fff;
  border-radius: 2px;
  box-shadow: 2px 2px 14px #d0d0d0;
  z-index: 2008;
}

.menu_style>ul>li {
  text-indent: 25px;
  height: 38px;
  line-height: 38px;
  border-bottom: 1px dashed #f0f0f0;
  cursor: pointer;
}

.menu_style>ul>li:hover {
  background: #e0eeff;
}

.dangerPatInfo tr td:nth-child(even) {
  width: 40px;
  border-bottom: 1px solid black;
}

.block {
  float: left;
  height: 91%;
  z-index: 100;
  position: relative;
  left: 0;
  top: 40px;
}

.alert-block {
  width: 100%;
  height: 100%;
  padding: 10px;
}

table tr td:nth-child(odd) {
  text-align: right;
  white-space: nowrap;
}

table tr td:nth-child(even) {
  text-align: left;
}

table tr td:nth-child(1) {
  width: 80px;
}

.pagetop table tr td {
  width: 80px;
}

table {
  font-size: 12px;
  border-collapse: separate;
  /* border-spacing: 5px; */
}

.pagetop {
  left: 0;
  right: 0;
  height: 36px;
  display: -webkit-box;
  -webkit-box-pack: center;
  -webkit-box-align: center;
  border: solid 1px #ccc;
  position: absolute;
  z-index: 99;
}

.pagebottom {
  width: 100%;
  height: 20px;
  display: -webkit-box;
  -webkit-box-pack: center;
  -webkit-box-align: center;
  position: absolute;
  bottom: 5px;
  font-size: 12px;
}

/* .middle-center {
  position: absolute;
  height: 100%;
  left: 305px;
  right: 605px;
  min-width: flex;
}

.middle-right {
  position: absolute;
  top: 0;
  bottom: 2px;
  right: 0px;
  width: 600px;
} */
.middle-left {
  /* position: absolute;
  height: 100%;
  width: 300px;
  left: 0px;
  top: 0; */
  overflow: hidden;
}

::v-deep .el-date-editor.el-input {
  width: auto;
}

::v-deep .Listclass .vxe-table .vxe-cell {
  padding: 0px;
}

::v-deep .middle-left .el-input--mini .el-input__inner {
  line-height: 18px;
  height: 20px;
}

::v-deep .tableleft .el-input--mini .el-input__inner {
  height: 20px;
  line-height: 20px;
}

/* ::v-deep  .tableleft .el-icon-time:before {
  content: "";
} */
::v-deep .tableleft .el-date-editor .el-input__icon {
  line-height: 20px;
  height: 20px;
  width: 20px;
}

::v-deep .tableleft .el-date-editor .el-input__prefix {
  left: 0px;
}

::v-deep .tableleft .el-input--prefix .el-input__inner {
  padding-left: 20px;
}

::v-deep .tableleft .el-input--suffix .el-input__inner {
  padding-right: 0px;
}

::v-deep .el-input-group__append {
  padding: 0 10px;
}

::v-deep .el-input--small .el-input__inner {
  border-radius: 3px;
}

::v-deep .el-dropdown-link {
  cursor: pointer;
  color: #409eff;
}

::v-deep .el-icon-arrow-down {
  font-size: 12px;
}

::v-deep .fixedpart {
  overflow: hidden;
}

::v-deep .specclass .el-input__inner {
  text-align: center;
  font-weight: bold;
  color: red;
  font-size: 18px;
}

::v-deep .el-radio {
  margin-right: 10px;
  font-size: 12px;
}

::v-deep .el-checkbox {
  margin-right: 10px;
  font-size: 12px;
}

::v-deep .el-checkbox__label {
  font-size: 12px;
}

::v-deep .el-radio__label {
  font-size: 12px;
  padding-left: 5px;
}

::v-deep .el-divider--horizontal {
  margin: 5px 0;
}

::v-deep .el-radio-group table tr td {
  width: 80px;
}

::v-deep .Config .el-input--mini .el-input__inner {
  height: 20px;
  line-height: 20px;
}

::v-deep #tab-TabColorH {
  color: red;
}

::v-deep #tab-TabColorR {
  color: red;
}

::v-deep .el-menu-item {
  height: 30px;
  line-height: 30px;
}

::v-deep .el-checkbox__input.is-disabled+span.el-checkbox__label {
  color: #606266;
}

::v-deep .ResultTable .vxe-table--body td {
  height: 18px !important;
}

::v-deep .ResultTable.vxe-table .vxe-cell {
  padding: 0;
  line-height: 18px;
}

::v-deep .buttonfloat .floatwindowsheader {
  height: 5px;
}

::v-deep .el-tabs__item {
  padding: 0 5px;
}

::v-deep .el-main {
  padding: 0;
}

::v-deep .el-checkbox__label {
  padding-left: 0;
}

::v-deep .el-checkbox {
  margin-right: 0;
}

.reqitem-dialog {
  position: absolute;
  z-index: 2069;
  box-shadow: 10px 10px 5px #888888;
}

::v-deep .inputred input {
  color: red;
}

::v-deep .el-tag {
  border-radius: 20px;
}

::v-deep .ReqTab .el-tabs__content {
  position: relative !important;
  top: 0px;
  height: calc(100% - 27px);
}

::v-deep .vxe-pager {
  padding: 2px 0;
}

::v-deep .ResultTxtTable.vxe-table .vxe-body--row td {
  background-color: #fff !important;
}

::v-deep .ResultTxtTable.vxe-table .vxe-body--row.row--hover td {
  background-color: #d7f1fd !important;
}

.wait-info {
  min-width: 350px;
}

::v-deep .emerflagredcolor .el-checkbox__input.is-checked+.el-checkbox__label {
  color: red;
}

::v-deep .search-param__text .el-checkbox {
  margin-right: 10px !important;
}

::v-deep .search-param__text .el-checkbox__label {
  padding-left: 3px !important;
}

::v-deep .rptitemdetail .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after {
  border: 2px solid #000000 !important;
  box-sizing: content-box;
  content: "";
  border-left: 0 !important;
  border-top: 0 !important;
}

.special-pat tr td:nth-child(even) {
  width: 75px;
  font-size: 16px !important;
  border-bottom: 1px solid black;
}

::v-deep .concern-reason {
  font-size: 16px !important;
  font-weight: bold;
  color: blue;
  background-color: #c0c0ff;
}

.special-pat-mark {
  position: absolute;
  z-index: 999;
  top: 140px;
  left: 150px;
}

::v-deep .labgroup-style {
  background-color: #c8c8c8 !important;
}</style>
